Wilder1626
asked on
VB6 - Transfer cell from MSFlexgrid into TEXTbox
Hi,
I would like to transfer all numbers from my MSHFlexgrid1 into my TextBox named clone_store so that each numbers shows one under the other.
Ex:
In MSHFlexgrid1:
1
2
3
4
5
Once in the TextBox clone_store
1
2
3
4
5
When i use the code below, it always leave an empty spaces on the first row of the textbox.
How can i fix this.
Thanks again for your help
I would like to transfer all numbers from my MSHFlexgrid1 into my TextBox named clone_store so that each numbers shows one under the other.
Ex:
In MSHFlexgrid1:
1
2
3
4
5
Once in the TextBox clone_store
1
2
3
4
5
When i use the code below, it always leave an empty spaces on the first row of the textbox.
How can i fix this.
Thanks again for your help
Dim clone As Long
For clone = 2 To MSHFlexGrid1.Rows - 1
If MSHFlexGrid1.TextMatrix(clone, 1) <> "" Then
clone_store = clone_store & vbCrLf & MSHFlexGrid1.TextMatrix(clone, 1)
End If
Next clone
Your code should work. Don't forget to set the Multiline property of the text box to True.
ASKER
Hi GrahamSkan
It work but it leaves an empty space on the first row of the textbox since the Textbox always start empty.
So what it does right now is:
----------------------
1
2
3
4
5
when it should do:
----------------------
1
2
3
4
5
It work but it leaves an empty space on the first row of the textbox since the Textbox always start empty.
So what it does right now is:
----------------------
1
2
3
4
5
when it should do:
----------------------
1
2
3
4
5
Try this and if it doesn't work then please zip up and attach your project files.
Dim clone As Long
For clone = 2 To MSHFlexGrid1.Rows - 1
If Trim(MSHFlexGrid1.TextMatrix(clone, 1)) <> "" Then ' no spaces between the quotes
clone_store = clone_store & vbCrLf & MSHFlexGrid1.TextMatrix(clone, 1)
End If
Next clone
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot for your help
It all works.
It all works.
You're welcome and I'm glad I was able to help.
Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013