Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have a simple datagridview generated dynamically

 

Friend WithEvents dgMemberNotes as DataGridView

dgMemberNotes.DataSource = db.GetDataSet("SELECT staff,comment,dtime FROM membernotes").Tables(0)

 

It works fine, however is it possible I can make column 1 a combobox, with selections from another query. i.e. SELECT staffname FROM staffmembers?

 

Thanks

Posted

Okay i've done this before the databinding

 

dgMemberNotes.Columns.Add(New DataGridViewComboBoxColumn)

dgMemberNotes.Columns.Add(New DataGridViewTextBoxColumn)

dgMemberNotes.Columns.Add(New DataGridViewTextBoxColumn)

 

But now my datagrid contains 6 columns, these 3 plus the 3 in generates automatically.

 

How do I get it to use the 3 columns i've created manually?

Posted

If you don't want to use the autogenerated columns then you can set the AutoGeneratedColumns property to false.

 

To bind the ComboBox column, you set it's DataSourceID (you may use DataSource property too, if you want).

 

For example something like that.

YourComboBoxColumn.DataSource = db.GetDataSet("your_second_query").Tables(0)

  • 2 weeks later...
Posted

I added the combobox column from design view, and If I do

dg.columns("ComboColumn").DataSource there's no such field as DataSource

 

How can I access the combobox from a comboboxColumn, I would preffer to set the value for each one, one by one.

 

(Because Later i'll need to read those values)

Development & Research Department @ Elven Soft

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...