Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBoxes in DataGridView

Status
Not open for further replies.

woogoo

Programmer
Feb 14, 2004
247
GB
I'm having problems implmenting ComboBoxes within a DataGridView. I have a grid containing 3 columns, each of these columns is defined as a DataGridViewComboBoxColumn.

At form load I want to populate the column on row 0 col 0 with a TimeInterval class. From here the user selects a time e.g. 07:00 then moves to col 1, row 0. At this point I now need get the selected index from col 0, row 0 so I can use it to exclude TimeIntervals all time intervals before this period prior to adding them into the row 0, col 1 combobox.

I've tired various approaches to this but when using my TimeInterval Class the datagrid complains that the data is invalid.

Code:
Public Class TimeInterval
    Private m_ID As Integer
    Private m_Interval As String

    Public Sub New(ByVal ID As Integer, ByVal Time As String)
        m_ID = ID
        m_Interval = Time
    End Sub

    Public ReadOnly Property ID() As Integer
        Get
            Return m_ID
        End Get
    End Property

    Public ReadOnly Property Interval() As String
        Get
            Return m_Interval
        End Get
    End Property

    Public Overrides Function ToString() As String
        Return m_Interval
    End Function
End Class

The above class contains an ID and a Time in the format of 00:00, and a range of these exists in a TimeIntervalsCollection.

Can anyone help me out here or point me in the direction of a good resource ComboBox use in DataGridViews.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top