-
July 16th, 2007, 10:45 PM
#1
[RESOLVED] Fill MSHFlexGrid using textbox
i able to fill one row of MSHFlexGrid form 6 textbox which i
assinged one by one. The problem is how to fill the next row coz
i want to fill about 100 row into my MSHFlexGrid form the same 6
textbox. Every time i add it will change the first row. I want
it to fill the next row. below is my coding:
Code:
Private Sub cmdAdd_Click()
Dim Iloop3 As Long
Dim R
Dim i As Integer
With MSHF2
.AddItem ""
.TextMatrix(.Row, 1) = txtMembership.Text
.TextMatrix(.Row, 2) = txtNamemem.Text
.TextMatrix(.Row, 3) = txtSandp.Text
.TextMatrix(.Row, 4) = txtNetprice.Text
.TextMatrix(.Row, 5) = txtStatus.Text
.TextMatrix(.Row, 6) = txtPremium.Text
End With
For Iloop3 = 0 To MSHF2.Rows - 1
MSHF2.TextMatrix(R, 0) = R
R = R + 1
Next
End Sub
-
July 16th, 2007, 11:08 PM
#2
Re: Fill MSHFlexGrid using textbox
You need to use a STATIC variable.
EDIT: you might want .MouseRow and .MouseCol for your grid.
Code:
Option Explicit
Private Sub Form_Load()
Static I As Integer ' doesn't get set back to 0 each time!
End Sub
Last edited by dglienna; July 16th, 2007 at 11:13 PM.
-
July 16th, 2007, 11:27 PM
#3
Re: Fill MSHFlexGrid using textbox
means, i replace the .textmatrix with .MouseCol and .MouseRow? Hows that, i never use these properties before.
-
July 16th, 2007, 11:32 PM
#4
Re: Fill MSHFlexGrid using textbox
They show you where the user clicked. You don't need both. You don't even need them to reload. Just use R (for ROW) like I said.
Don't use a loop. Just update each of R's col's ONCE
Code:
.TextMatrix(R, 1) = txtMembership.Text
Last edited by dglienna; July 16th, 2007 at 11:36 PM.
-
July 16th, 2007, 11:40 PM
#5
Re: Fill MSHFlexGrid using textbox
I don't get it Mr.David.
The loop i put there is for the column 0 numbering. Do you mean i need to take out the With ?
-
July 16th, 2007, 11:47 PM
#6
Re: Fill MSHFlexGrid using textbox
This is what I mean:
Code:
Private Sub cmdAdd_Click()
Dim Iloop3 As Long
Static R
Dim i As Integer
With MSHF2
.AddItem ""
.TextMatrix(R, 0) = R ' might want to use R + 1
.TextMatrix(R, 1) = txtMembership.Text
.TextMatrix(R, 2) = txtNamemem.Text
.TextMatrix(R, 3) = txtSandp.Text
.TextMatrix(R, 4) = txtNetprice.Text
.TextMatrix(R, 5) = txtStatus.Text
.TextMatrix(R, 6) = txtPremium.Text
End With
R = R + 1
End Sub
-
July 18th, 2009, 01:31 AM
#7
Re: [RESOLVED] Fill MSHFlexGrid using textbox
David is Gr88888888888888
-
July 18th, 2009, 05:02 AM
#8
Re: [RESOLVED] Fill MSHFlexGrid using textbox
Yes David is great!
Just remember this thread is 2 years old
Keep posting at this wonderful site Registered2009, if you have questions, don't hesitate in posting a New Thread about your topic, and you'll find out how many more great members post here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|