 |
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 2nd, 2005, 04:29 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 2nd, 2005, 05:34 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 2nd, 2005, 06:01 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 2nd, 2005, 06:16 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 2nd, 2005, 06:38 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Done with the Array.
Many thanks Raghavendra.
Regards,
Vinay
|
|

August 2nd, 2005, 12:39 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

February 10th, 2006, 08:29 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

February 10th, 2006, 08:34 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

March 8th, 2006, 08:04 AM
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |