|
-
Jan 26th, 2000, 04:28 AM
#1
Thread Starter
Member
How can I set a specific column width in my flexgrid? In addition, is it possible to click on a row, then click a command button and open a new form and display that particular record?
-
Jan 26th, 2000, 04:31 AM
#2
Hyperactive Member
intCol = MSFlexGrid1.col
intRow = MSFlexGrid1.row
Those would give you the col and row of the cell you cliked on. In reverse:
MSFlexGrid1.row = intRow
MSFlexGrid1.col = intCol
You can use these to cycle through the grid if you want or retrieve the info from a database.
-
Jan 26th, 2000, 04:39 AM
#3
Use the ColWidth() Property to specify the Width of a Specific Cell, ie.
MSFlexGrid1.ColWidth(0) = 500
You can just Reference the MSFlexGrid1 Object on Form1 from Form2, ie.
Add a Textbox called txtField to Form2 and set its Index Property to Zero..
In Form1..
Code:
Private Sub Form_Load()
Dim iIndex As Integer
With MSFlexGrid1
.SelectionMode = flexSelectionByRow
.FocusRect = flexFocusNone
.Cols = 4
.Rows = 5
.FixedCols = 0
.FixedRows = 0
For iIndex = 0 To 19
.TextArray(iIndex) = Rnd * 100
Next
End With
End Sub
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
In Form2..
Code:
Private Sub Form_Load()
Dim iField As Integer
With Form1.MSFlexGrid1
For iField = 0 To .Cols - 1
If iField Then Load txtField(iField)
txtField(iField).Move txtField(0).Left, txtField(0).Top + (iField * txtField(0).Height)
txtField(iField) = .TextMatrix(.Row, iField)
txtField(iField).Visible = True
Next
End With
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 27th, 2000, 07:42 AM
#4
Thread Starter
Member
Hi Aaron,
When I put the code in as you've described above, I get error " Compile Error: Wrong number of arguments or invalid property assignmen." Any suggestions? Thanks.
-
Jan 27th, 2000, 07:48 AM
#5
Works fine when I cut and Paste it..
Did you Add a 2nd Form, with a Textbox on it called txtField with an Index Value of 0(Zero)?
If so, where are you getting the Error?
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 27th, 2000, 10:41 PM
#6
Thread Starter
Member
Allright, here's the situation. On form1 I click a row, then I click command2, the error then occurs on form2 at line: txtField(iDate).Move txtField(0).Left, txtField(0).Top(iDate * txtField(0).Height)....Top is highlighted...also, when I click on the button, flexgrid1 on form1 changes to several rows with random numbers!! Any suggestions?
Thanks,
Dave
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
|