| | |
kindly help me
Thread Solved
![]() |
•
•
Join Date: Dec 2008
Posts: 287
Reputation:
Solved Threads: 1
In a msflexgrid control , i want to give the option to the user to select a single row or a group of rows from msflex grid control the if
use clickon the product_id from first msflexgrid contrl1 since this
grid contains complete list of product_id it selected record should
come on another msflexgrid2
Kindly help me.
i have written a code like that :
Private Sub Form_Load()
Set con = New Connection
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\asfserver\itp$\Product_tabletest.mdb")
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Combo1.AddItem "ADMIN & IT"
Combo1.AddItem "SALES"
Combo1.AddItem "ENGINEERING"
Combo1.AddItem "MAINTENANCE"
Combo1.AddItem "MANUFACTERING"
Combo1.AddItem "FINANCE"
Combo1.AddItem "QUALITY CONTROL"
Text13.Locked = Not editing
MSFlexGrid1.FixedRows = 1
MSFlexGrid1.FillStyle = flexFillRepeat
MSFlexGrid1.ColWidth(0) = 1000
MSFlexGrid1.ColWidth(1) = 3500
MSFlexGrid1.ColAlignment(0) = 4
MSFlexGrid1.ColAlignment(1) = 4
MSFlexGrid1.ColAlignment(2) = 4
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 0
MSFlexGrid1.RowSel = 5
MSFlexGrid1.Cols = 10 'Set dimensions of flexgrid and set selection behaviour
MSFlexGrid1.Rows = 10 'displaying grid
On Error Resume Next
MSFlexGrid1.CellFontBold = True
MSFlexGrid1.CellAlignment = 4
MSFlexGrid1.Font = "Arial"
MSFlexGrid1.TextMatrix(0, 0) = "Product_id"
MSFlexGrid1.TextMatrix(0, 1) = "Product_name"
MSFlexGrid1.TextMatrix(0, 2) = "Unit"
MSFlexGrid1.TextMatrix(0, 3) = "Quantity"
Dim R, C
Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.Open "select distinct item_code,Productname,unit from partdetail ", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
Do Until rs.EOF
R = R + 1
For C = 0 To 4 Step 1
MSFlexGrid1.Rows = rs.RecordCount + 1
MSFlexGrid1.TextMatrix(R, C) = rs.Fields(C).Value
Next
rs.MoveNext
Loop
End If
End Sub
use clickon the product_id from first msflexgrid contrl1 since this
grid contains complete list of product_id it selected record should
come on another msflexgrid2
Kindly help me.
i have written a code like that :
Private Sub Form_Load()
Set con = New Connection
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\asfserver\itp$\Product_tabletest.mdb")
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Combo1.AddItem "ADMIN & IT"
Combo1.AddItem "SALES"
Combo1.AddItem "ENGINEERING"
Combo1.AddItem "MAINTENANCE"
Combo1.AddItem "MANUFACTERING"
Combo1.AddItem "FINANCE"
Combo1.AddItem "QUALITY CONTROL"
Text13.Locked = Not editing
MSFlexGrid1.FixedRows = 1
MSFlexGrid1.FillStyle = flexFillRepeat
MSFlexGrid1.ColWidth(0) = 1000
MSFlexGrid1.ColWidth(1) = 3500
MSFlexGrid1.ColAlignment(0) = 4
MSFlexGrid1.ColAlignment(1) = 4
MSFlexGrid1.ColAlignment(2) = 4
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 0
MSFlexGrid1.RowSel = 5
MSFlexGrid1.Cols = 10 'Set dimensions of flexgrid and set selection behaviour
MSFlexGrid1.Rows = 10 'displaying grid
On Error Resume Next
MSFlexGrid1.CellFontBold = True
MSFlexGrid1.CellAlignment = 4
MSFlexGrid1.Font = "Arial"
MSFlexGrid1.TextMatrix(0, 0) = "Product_id"
MSFlexGrid1.TextMatrix(0, 1) = "Product_name"
MSFlexGrid1.TextMatrix(0, 2) = "Unit"
MSFlexGrid1.TextMatrix(0, 3) = "Quantity"
Dim R, C
Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.Open "select distinct item_code,Productname,unit from partdetail ", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
Do Until rs.EOF
R = R + 1
For C = 0 To 4 Step 1
MSFlexGrid1.Rows = rs.RecordCount + 1
MSFlexGrid1.TextMatrix(R, C) = rs.Fields(C).Value
Next
rs.MoveNext
Loop
End If
End Sub
Hi,
Place a CommandButton "Populate" in the Frame,
Initially, Make Grid2.Rows = 1.
Select a Row, in First Grid, and Click On "Populate", write this code for commandClick.
Regards
Veena
Place a CommandButton "Populate" in the Frame,
Initially, Make Grid2.Rows = 1.
Select a Row, in First Grid, and Click On "Populate", write this code for commandClick.
vb Syntax (Toggle Plain Text)
Dim i As Integer If Grid1.Row > 0 Then Grid2.Rows=Grid2.Rows+1 With Grid2 .TextMatrix(.Rows-1, 0) = Grid1.TextMatrix(.Row,0) .TextMatrix(.Rows-1, 1) = Grid1.TextMatrix(.Row,1) .TextMatrix(.Rows-1, 2) = Grid1.TextMatrix(.Row,2) .TextMatrix(.Rows-1, 3) = Grid1.TextMatrix(.Row,3) End With End If
Regards
Veena
Last edited by QVeen72; Dec 16th, 2008 at 5:39 am.
•
•
Join Date: Dec 2008
Posts: 287
Reputation:
Solved Threads: 1
as per your suggestion i have written a code in populate_click
Private Sub populate_Click()
MSFlexGrid2.Row = 4
Dim i As Integer
If MSFlexGrid1.Row > 0 Then
MSFlexGrid2.Rows = MSFlexGrid2.Row + 1
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 0) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 0)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 1) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 1)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 2) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 2)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 3) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 3)
End If
End Sub
but when i select multiple record got error Subscript out of range
Run time error 381
Kindly help me
Private Sub populate_Click()
MSFlexGrid2.Row = 4
Dim i As Integer
If MSFlexGrid1.Row > 0 Then
MSFlexGrid2.Rows = MSFlexGrid2.Row + 1
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 0) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 0)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 1) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 1)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 2) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 2)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Row - 1, 3) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 3)
End If
End Sub
but when i select multiple record got error Subscript out of range
Run time error 381
Kindly help me
•
•
Join Date: Dec 2008
Posts: 287
Reputation:
Solved Threads: 1
Private Sub Command5_Click()
Dim i As Integer
If MSFlexGrid2.Row > 0 Then
MSFlexGrid2.Rows = MSFlexGrid2.Row + 1
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 0) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 0)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 1) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 1)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 2) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 2)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 3) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 3)
End If
End Sub
since i am checking If MSFlexGrid2.Row > 0 Then
that is why i put msflexgrid2.row=4
right now i am getting run time error 381
help me please .
Dim i As Integer
If MSFlexGrid2.Row > 0 Then
MSFlexGrid2.Rows = MSFlexGrid2.Row + 1
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 0) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 0)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 1) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 1)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 2) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 2)
MSFlexGrid2.TextMatrix(MSFlexGrid1.Rows - 1, 3) = MSFlexGrid1.TextMatrix(MSFlexGrid2.Row, 3)
End If
End Sub
since i am checking If MSFlexGrid2.Row > 0 Then
that is why i put msflexgrid2.row=4
right now i am getting run time error 381
help me please .
![]() |
Similar Threads
- kindly find the attachment (Visual Basic 4 / 5 / 6)
- kindly explain this strange behaviour of == and inerface (Java)
- Kindly help me... (C++)
- Kindly tell the flaw in the code? (C++)
- how to write I.N.I database in my path....kindly see (Visual Basic 4 / 5 / 6)
- Need Affiliates (interested Personnels Kindly Apply) (Tech / IT Consultant Job Offers)
- kindly solve this problem (Windows NT / 2000 / XP)
- PLease kindly help me, Please!! (Windows Servers and IIS)
- kindly have a look at my pages (Website Reviews)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Textframe in Power point + coloring text
- Next Thread: scrollbar control that is changing its colour
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web windows





