小小格式化的问题
我是一个刚入门的新手,自已照着书写了些代码,但出了点问题,希望那位高手路过指点一下是那里出了问题啊,谢谢了Public Class 计算圆的面积
Function CalculateAreaFromRadius(ByVal radius As Double) As Double
Dim radiusSquared As Double
radiusSquared = radius * radius
Dim result As Double
result = radiusSquared = radius * radius
result = radiusSquared * Math.PI
Return result
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim area As Double
area = CalculateAreaFromRadius(100)
MessageBox.Show(area, "Area")
Dim s As String
s = String.Format("{0:area3}", area)
MessageBox.Show("with formatting:" & s)
End Sub
End Class
为什么
Dim s As String
s = String.Format("{0:area3}", area)
MessageBox.Show("with formatting:" & s)
这些代码无法格式化啊???? --------------------编程问答-------------------- 帮你UP一下,贴子都沉了。 --------------------编程问答-------------------- s = String.Format("{0:area3}", area) 中的 area3 是什么意思?
s = String.Format("{0}:area3", area)
s = String.Format("{0:D3}", area)
补充:.NET技术 , VB.NET