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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Grid Question

Status
Not open for further replies.

shannanl

IS-IT--Management
Apr 24, 2003
1,071
US
I am using a data grid to display some information. One column I wish to set as a numeric only column. This would be the "requested" column. How can I make sure that the user can only enter numeric keystrokes in this column? My other question deals with the "priority" column. I have it as a drop down combo but I wish to populate it with two values, "Routine" and "Stat". How can I populate the column and then let the user select? I would like it to default to Routine.

Here is my code so far. Thanks in advance for your help.

Shannan

DataGridView1.Columns.Add("Name", "Name")
DataGridView1.Columns.Add("OnHand", "On Hand")
DataGridView1.Columns.Add("Requested", "Requested")

Dim prioritycolumn As New DataGridViewColumn
prioritycolumn = New DataGridViewComboBoxColumn()
DataGridView1.Columns.Add(prioritycolumn)
With DataGridView1.Columns.Item(3)
.Name = "Priority"
.HeaderText = "Priority"
.Width = 165
End With

DataGridView1.Columns(0).ReadOnly = True
DataGridView1.Columns(1).ReadOnly = True

DataGridView1.Rows.Add("Widget", 1, 0)
DataGridView1.Rows.Add("I.V.", 3, 0)
DataGridView1.Rows.Add("Needle", 2, 0)
 
Have a look here to get you going on this one.


Have fun.

A.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
Rick Cook, The Wizardry Compiled
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top