Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old August 2nd, 2005, 04:29 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Vinay

For that you can use this

Private Sub Form_Load()
For q = 1 To Me.MSHFlexGrid1.Rows - 1
    Me.MSHFlexGrid1.ColData(1) = q
    Me.MSHFlexGrid1.RowData(q) = q
Next
End Sub

Private Sub MSHFlexGrid1_Click()
MsgBox Me.MSHFlexGrid1.RowData(Me.MSHFlexGrid1.RowSel)
End Sub

ColData and RowData stores extra numeric information that we can
use programatically. And those values are not visible to
any one.

Hope this helps

With Regards,
Raghavendra Mudugal
Reply With Quote
  #12 (permalink)  
Old August 2nd, 2005, 05:34 AM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Raghavendra,

Again am stuck..

The problem is that am fetching that id from a temporary table which stores id from two different tables, hence prefixes id with a single character, depending upon the table it is coming from.

So Me.grid.ColData(1)=rs("field_type_id") gives "type mismatch" as it happens to be alphanumeric.

Also is there any way to store the data only in 1st column and not in all columns of all rows,becaus when i code only for ColData and not RowData then the data is not stored.

Regards,

Vinay
Reply With Quote
  #13 (permalink)  
Old August 2nd, 2005, 06:01 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok.

Coldata and Rowdata stores only numeric (long type).
For storing the ID in only first column, just pass the index
of the first column. and loop through the rows my incrementing
the row index. See the example in my previous post.

For storing the ID what you can do is the best.. while you
add to the flexgrid say ID = "EMP1" (something like this)
remove the "EMP" while you add just store "1" in the RowData
and for updating the flag in the table there you attach "EMP"
with the ID of the row selected. So again it becomes "EMP1"
which you can find the rows with this ID in the table.

I guess it is clear to you.

Hope this helps

With Regards,
Raghavendra Mudugal
Reply With Quote
  #14 (permalink)  
Old August 2nd, 2005, 06:16 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OR

1.
you can take an array of string and load the IDs to this
and while updating the table get the ID from that array
with respect to the row number. So you will have the
IDs exactly as it is the table.

2. Load the IDs in saperate column at the end of columns and
set the colwidth to 1 which is like , it exists but it cannot
be viewed and make sure that you do not allow the column
resize. (if yes then above 1st point is what i see now)

Hope this helps

With Regards,
Raghavendra Mudugal
Reply With Quote
  #15 (permalink)  
Old August 2nd, 2005, 06:38 AM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Done with the Array.

Many thanks Raghavendra.

Regards,

Vinay


Reply With Quote
  #16 (permalink)  
Old August 2nd, 2005, 12:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If the check box needs to go only in the first column, it is much easier just to use a ListView in Report mode, that has that capability built in. Not only that, but when you add a row you can assign an alphanumeric Tag to each row, that can be used in your case to store a record id. Thus, no need either for images, extra arrayes or an extra font (that needs to be distribuited with the application).
Marco
Reply With Quote
  #17 (permalink)  
Old February 10th, 2006, 08:29 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Raghavendra

i ned help with vb.

i have to populate say n numbers in a flexgrid, which i am able to do from a database.

now i have to add checkbox for each number such that on checking a particular number checkbox, tht number is added in another table of a database.

also the numbers are populated by selecting options from two combo boxes.

kindly help at the earliest.

Reply With Quote
  #18 (permalink)  
Old February 10th, 2006, 08:34 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry

i can populate the numbers.

i need help only with the checkboxes. i have seen ur previous replies.

but i hav noticed, tht on chking the flexgrid anywhere, the chkbox is selected.

how do i add 100 chkboxes?

please help at the earliest.

tina

Reply With Quote
  #19 (permalink)  
Old March 8th, 2006, 08:04 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vinay and Ragavendra,

I am using Flexgrid in C#.. I want to place a checkboxes in that.. I tried to handle the "ClickEvent" Event of flexgrid and wrote the following code

switch(axMSFlexGrid1.Col)
            {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                        MessageBox.Show("CilcikeD");
                        break;
                case 8:
                    chkSelect.Visible = true;
                    chkSelect.Left = axMSFlexGrid1.Left + axMSFlexGrid1.CellLeft;
                    chkSelect.Top = axMSFlexGrid1.Top + axMSFlexGrid1.CellTop;
                    if(axMSFlexGrid1.Text == "Selected")
                    {
                        chkSelect.Text ="1";
                    }
                    else
                    {
                        chkSelect.Text = "0";
                    }

                    chkSelect.Focus();
                    chkSelect.Visible = true;
                    break;

            }

but its not showing me the checkboxes.. Will u please correct the problem if any and give me a solution for that... Please its very urgent

Bye

Regards
Saravanan

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FlexGrid amlesh Beginning VB 6 0 July 26th, 2007 01:31 AM
Vs-flexgrid MathLearner Beginning VB 6 0 June 4th, 2007 01:52 AM
FlexGrid and Add Control santanu.roy VB Components 0 June 21st, 2006 04:49 AM
how to add checkboxes in this asp gilgalbiblewheel Classic ASP Databases 1 August 10th, 2004 12:17 AM
FLEXGRID...HELP!!! apek VB How-To 4 January 20th, 2004 05:19 PM



All times are GMT -4. The time now is 04:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.