By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

how to create a tag in datagrid column

P: n/a
i have a datagrid in my form that has a combobox in it. the actual
data of a combobox is a number because this is a foreign key from
another table. i can create tag successfully in combobox located in
form but not inside the datagrid.

this is the sample combobox that i have created that has no problem
With cboProgram
.DataSource = DsStudentCourse1
.DisplayMember = "Program.ProgramTitle"
.ValueMember = "Program.ProgramID"
.DataBindings.Add("Tag",
DsStudentCourse1.Tables("Students"), "ProgramID")
.DataBindings.Add(New Binding("SelectedValue", _
DsStudentCourse1, "Students.ProgramID"))
End With

and call this tag using this code w/ out problem

Dim intProgramID As Integer = cboProgram.Tag.ToString

here's my problem. i try this w/ no luck

Dim grdColStyle6 As New DataGridComboBoxColumn()

With grdColStyle6
.MappingName = "MajorID" 'must be from the grid
table...
.HeaderText = "Major"
.Width = 120
.ColumnComboBox.DataSource =
DsStudentCourse1.Tables("Major").DefaultView 'dv;
.ColumnComboBox.DataBindings.Add("Tag",
DsStudentCourse1.Tables("Major"), "MajorID")
.ColumnComboBox.DisplayMember = "MajorID"
.ColumnComboBox.ValueMember = "MajorID"

grdTableStyle1.PreferredRowHeight =
..ColumnComboBox.Height + 2
End With

i have put the variable grdColStyle6 outside this procedure so that i
can call it from other procedure...

here's my sample code that does not work after calling the tag.

Dim intMajorID As Integer = grdColStyle6.ColumnComboBox.Tag

i would be very glad for any help you can give.
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.