بالاخره دستورشو اینطور نوشتم و درست شد :
برای تکست باکس :
Dim n As Double = TextBox1.Text
TextBox1.Text = n.ToString("###,###")
TextBox1.Select(TextBox1.Text.Length, 0)
برای دیتاگرید :
Private Sub moneycell()
Dim newStyle As New DataGridViewCellStyle
newStyle.Format = "###,###"
DataGridView1.Columns(1).DefaultCellStyle.ApplySty le(newStyle)
End Sub
Private Sub DataGridView1_CellFormatting(sender As Object, e As System.Windows.Forms.DataGridViewCellFormattingEve ntArgs) Handles DataGridView1.CellFormatting
If Not IsNothing(e.Value) Then
If IsNumeric(e.Value) Then
e.Value = Format(CDbl(e.Value), e.CellStyle.Format)
End If
End If
End Sub