I am using Visual Basic 6 and have a form with an MSFlexgrid (2 columns) and a textbox which is used to edit the MSFlexgrid. I have set the maxlength property of the textbox to 7 to limit the number of digits entered in. I'm not sure what my options are but I would like to do the following: Format the MSFlexgrid so that column 1 will automatically show the entered value to 3 decimal places and column 2 will place the decimal based on the user's choice from a dropdownlist box. I have attached a snippet of my code to Format Column 1 only; what happens is It will place a decimal at then end of the digits entered instead of where it is supposed to.
Private Sub FormatColumn1(sFormat as String)
MSFlexGrid1.Redraw = False
For lRow = MSFlexGrid1.FixedRows To MSFlexGrid1.Rows - 1
sFormat = MSFlexGrid1.TextMatrix(lRow, 2)
sFormat = Format$(sFormat, "###.###")
MSFlexGrid(lRow, 2) = sFormat
MSFlexGrid1.Redraw = True