954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Text collect from MSflexgrid to textbox

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.

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

any one can help me please

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

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

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

its not work.

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

sorry it works

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

Can u attach the three forms?

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

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 ........

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

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

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

label1 mean?

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

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

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

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..

vinzanity
Newbie Poster
2 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

plz make ur problem a little more clear.

Regards
Shaik Akthar

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You