I have 4 text box in a form. when I click a button another Form show with a MSflexgrid. when I click in a msflexgrid the data show a text box of another form. I write code:
form1.Text1.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, MSFlexGrid1.ColSel)

But I when I click msflexgrid the same data show all 4 textbox. But I want 4 item of data in msflexgrid show in 4 text box separetly . please help me.

any one can help me please

If the remaining cells are the adjacent to each other, you can hardcode the column numbers!

form1.Text1.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 0) 'For data in Column 0
form1.Text2.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 1) 'For data in Column 1
form1.Text3.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 2) 'For data in Column 2
form1.Text4.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 3) 'For data in Column 3

The row is constant for the row u have selected. only change the columns.

Regards
Shaik Akthar

its not work.

sorry it works

Can u attach the three forms?

don't mind. If the remaining cells are not the adjacent to each other and I want click separatly each cell for each text then what I write. Please ........

Use Select Case

Select Case MSFlexGrid1.ColSel
    Case 0:
         form1.Text1.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, MSFlexGrid1.ColSel)
         goto Label1
    Case 1:
         form1.Text2.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, MSFlexGrid1.ColSel)
         goto Label1
    Case 2:
         form1.Text3.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, MSFlexGrid1.ColSel)
         goto Label1
    Case 3:
         form1.Text4.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, MSFlexGrid1.ColSel)
         goto Label1
End Select

Label1:

Regards
Shaik Akthar

label1 mean?

I have just put a label outside the select case BLOCK to transfer the control outside of the select block once any case is executed. but it is not mandatory. YOU CAN OMIT THE GOTO STATEMENT

Regards
Shaik Akthar

same problem here..
what if the value is from the database?
not just the text from msflexgrid.

please correct my code.

txtsol.Text = rs.Fields("sol").Value & fgrid.TextMatrix(fgrid.RowSel, fgrid.ColSel)

what will happen now is, the row from db will populate all the textboxes in the form from a click in msflexgrid.

any advice? thanks..

plz make ur problem a little more clear.

Regards
Shaik Akthar

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.