Can someone please correct my statement ?

M

Mac

VB6.


I selected records from SQL2K and saved into cursor.
Now I want to display on the screen by using MSFLEXGRID. I tried listbox
and I can see the data but I want it in msflexgrid.

I tried following statement but it just put part number and price in the
first column.

I want part number in first and price in second column like spreadsheet.

I would appreciate if someone please correct my statement.

Myform.MSFlexGrid1.AddItem rs!partno & Space(5) & rs!price

Thank you very much.
 
R

Rick Rothstein [MVP - Visual Basic]

I selected records from SQL2K and saved into cursor.
Now I want to display on the screen by using MSFLEXGRID. I tried listbox
and I can see the data but I want it in msflexgrid.

I tried following statement but it just put part number and price in the
first column.

I want part number in first and price in second column like spreadsheet.

I would appreciate if someone please correct my statement.

Myform.MSFlexGrid1.AddItem rs!partno & Space(5) & rs!price

Try this and see if it works...

Myform.MSFlexGrid1.AddItem rs!partno & vbTab & rs!price

Rick
 
S

Someone

You could also try:

MSFlexGrid1.Row =1

MSFlexGrid1.Col =1
MSFlexGrid1.Text = rs!partno
MSFlexGrid1.Col =2
MSFlexGrid1.Text = rs!price
 
R

Rick Rothstein [MVP - Visual Basic]

You could also try:
MSFlexGrid1.Row =1

MSFlexGrid1.Col =1
MSFlexGrid1.Text = rs!partno
MSFlexGrid1.Col =2
MSFlexGrid1.Text = rs!price

Actually, if you want to do it by separate cell entries, I like
using the TextMatrix property since that does not require you to
continually set and reset the Row and Col properties...

MSFlexGrid1.TextMatrix(1, 1) = rs!partno
MSFlexGrid1.TextMatrix(1, 2) = rs!price

The TextMatrix property also works very nicely in a loop.

Rick
 
M

MikeD

Jeff Johnson said:
Then please don't crosspost to a .NET group.


Also need to question posting to a Word newsgroup. What does this have to do
with Word? For that matter, I don't see where or how ADO comes into play
either.

Mac, what we're really telling you is that you need to choose the newsgroups
you post to a little more carefully. No newsgroup appreciates off-topic
posts. And trust me, regular newsgroup readers REMEMBER those who "abuse"
the newsgroups and may not offer help in the future....so....you're really
hurting yourself by posting to non-relevant newsgroups.
 
A

Amit Mohod

Try following code:

Myform.MSFlexGrid1.AddItem rs!partno & Char(9) & rs!price

Chr(9) is a Tab key code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top