|
-
Apr 26th, 2002, 03:05 AM
#1
Thread Starter
Lively Member
getting data from the grid to labels using ADO ****SOLVED****
Howdy,
I'm having some troubles converting my DAO program to an ADO program. Here's the situation:
The program used to get information from the grid and put it to a few labels on top of the form. That was done by simply fill in the Datasource and the datafield in the properties box. Now that I'm using ADO, I don't have a datacontrol anymore.
How do I get my data from the grid (MSHFlexgrid) to the labels as I select a record?
If you need to see any code on how I acces my DB let me know
WiseGuy
Last edited by WiseGuy; Apr 26th, 2002 at 04:54 AM.
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 26th, 2002, 03:24 AM
#2
Fill in the flexgrid via code (you've done this I expect). Ensure all data you need is in there.
Hide columns you don't want seen by changing the column width on opening the form/filling the list (Flexgrid.ColWidth(<column number>)=0)
When the row is selected (by a click) use the click event to grab all the data from the columns to the labels
VB Code:
lngRowSel = FlexGrid.row '(or RowSel - can't rememebr which)
labeltodisp(0).caption = flexgrid.textmatrix(lngRowSel,0)
labeltodisp(1).caption = flexgrid.textmatrix(lngRowSel,1)
labeltodisp(2).caption = flexgrid.textmatrix(lngRowSel,2)
Something like that.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 26th, 2002, 03:48 AM
#3
Thread Starter
Lively Member
Thanks for the code but how do I define 'lngRowSel'
Is it just a string variable or what?
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 26th, 2002, 03:50 AM
#4
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 26th, 2002, 03:57 AM
#5
Thread Starter
Lively Member
I get the Error Type mismatch on the second line.
Any solutions or Ideas?
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 26th, 2002, 04:09 AM
#6
The second line - of the one I typed ?
I assumed you had label controls on there...
labeltodisp.caption = flexgrid.textmatrix(lngRowSel,0)
Paste your code up please.
I am writing from my head, no vb here. Wish I could have it though.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 26th, 2002, 04:23 AM
#7
Thread Starter
Lively Member
Okey here's the code:
VB Code:
Private Sub grdDatagrid_Click()
Dim lngRowSel As Long
lngRowSel = grdDataGrid.RowSel
grdDataGrid.TextMatrix(lblProcesInstellingId, 1) = lblProcesInstellingId.Caption
grdDataGrid.TextMatrix(lblNaam, 2) = lblNaam.Caption
grdDataGrid.TextMatrix(lblType, 3) = lblType.Caption
End Sub
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 26th, 2002, 04:34 AM
#8
ummmmmmmmmmmmmmm
VB Code:
Private Sub grdDatagrid_Click()
Dim lngRowSel As Long
lngRowSel = grdDataGrid.RowSel
grdDataGrid.TextMatrix(lblProcesInstellingId, 1) = lblProcesInstellingId.Caption
grdDataGrid.TextMatrix(lblNaam, 2) = lblNaam.Caption
grdDataGrid.TextMatrix(lblType, 3) = lblType.Caption
End Sub
How do I get my data from the grid (MSHFlexgrid) to the labels as I select a record?
Change to :
VB Code:
Private Sub grdDatagrid_Click()
Dim lngRowSel As Long
lngRowSel = grdDataGrid.RowSel
lblProcesInstellingId.Caption=grdDataGrid.TextMatrix(lngRowSel, 1)
lblNaam.Caption=grdDataGrid.TextMatrix(lngRowSel, 2)
lblType.Caption=grdDataGrid.TextMatrix(lngRowSel, 3)
End Sub
Vince
Last edited by Ecniv; Apr 26th, 2002 at 04:42 AM.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 26th, 2002, 04:38 AM
#9
Thread Starter
Lively Member
Thanks that was the trick
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 26th, 2002, 04:51 AM
#10
OK, one last thing to help ppl helping others in the forum. Once your post is complete (ie the problem has been solved)
Look at your posts, on the first one, click edit button (bottom of the first post) then change the topic/title to include "**resolved**" at the end 
Then ppl like me who are ahem *coughboredcough* at work and helping others know that its complete 
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
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
|