i have 1 msflexgrid. in column two, i want to set the data for integer value and 1 decimal places.how to set this column?
anybody can help me...
i'm using visual basic6

Recommended Answers

All 3 Replies

I take it that the data in coloumn 2 is an integer (amount)? Do you want to calculate the sum of all amounts in coloumn 2 and show that total amount in a text box?

I take it that the data in coloumn 2 is an integer (amount)? Do you want to calculate the sum of all amounts in coloumn 2 and show that total amount in a text box?

no..i insert only one integer (double)..
for example:-
2.1 in column 2
if user insert 2.13, it's only display 2.1...
how to setting this column same like that??

Try the following:

Set CON = New ADODB.Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\FlexGridSample.mdb;"
Set RS = New ADODB.Recordset
RS.Open "SELECT * FROM TableName", CON, adOpenStatic, adLockBatchOptimistic
set MSFlexgrid.DataSource = RS
Dim i as Long, j as Long
For i = 1 To RS.RecordCount  'this loop is for rows
   For j = 1 To RS.Fields.Count 'this loop is for Columns
      MSFlexgrid.TextMatrix(i, 1) = Format(RS!  SecondFieldName,"###.#") 'Your format of only 1 decimal. See (i,1) where 1 is the second coloumn
    Next

    RS.MoveNext
  Next

Attached a more detailed grid and comment help for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.