If RadioButtonAC144.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/144
ElseIf RadioButtonAC72.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/72
ElseIf RadioButtonAC48.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/48
ElseIf RadioButtonAC35.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/35
ElseIf RadioButtonAC32.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/32
ElseIf RadioButtonAC24.Checked = True Then
TextBoxACScale.Text = TextBoxACReal.Text/24
End If
这是我的代码,我有多个页面(标签)与此类似,所以这是一个PITA改变了这一切,但如果它是唯一的办法那就这样吧,但是我只是需要在TextBoxACScale.Text中显示的结果最多只显示2位小数。单击计算按钮时将实现此代码。2位小数结果在VB
http://stackoverflow.com/questions/5168592/force-a-string-to-2-decimal-places VB.net和C#是相同的。使用String.Format –
你不能用整数分割文本。你必须将文本转换为数字,进行分割,然后转换回来。 – ja72
现在一切正常。我改变了剩下的部分。作为领导与文本的分工,这样的工作很好。 – Michael