Click here to Skip to main content
15,925,181 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionActive row after datagrid refresh? Pin
lucyzhu5-Apr-07 4:47
lucyzhu5-Apr-07 4:47 
AnswerRe: Active row after datagrid refresh? Pin
Sathesh Sakthivel5-Apr-07 6:58
Sathesh Sakthivel5-Apr-07 6:58 
QuestionActive row after datagrid refresh? Pin
lucyzhu5-Apr-07 4:47
lucyzhu5-Apr-07 4:47 
QuestionVB.Net and INI file Pin
directred5-Apr-07 3:33
directred5-Apr-07 3:33 
AnswerRe: VB.Net and INI file Pin
MatrixCoder5-Apr-07 5:32
MatrixCoder5-Apr-07 5:32 
AnswerRe: VB.Net and INI file Pin
kubben5-Apr-07 5:55
kubben5-Apr-07 5:55 
QuestionUsing a ComboBox for a Cell in a DataGridView Pin
RichFeldman5-Apr-07 3:27
RichFeldman5-Apr-07 3:27 
AnswerRe: Using a ComboBox for a Cell in a DataGridView Pin
Dave Kreskowiak6-Apr-07 4:24
mveDave Kreskowiak6-Apr-07 4:24 
You would normally create your own DataGridView columns, not relying on the auto-generated columns. Basically, you're getting two tables from the database into a DataSet. The first is the data your showing in the DGV. The second supplies the values you want to show in the ComboBox column. You can then create a ComboBox column using something like:
Private Sub SetupDataGridView()
        DGV1.Columns.Clear()
 
        ' Table1 is going to have our data in it.
        ' Table2 is supplying what shows up in the ComboBox's.
 
        Dim newCol As New DataGridViewComboBoxColumn
        With newCol
            .HeaderText = "headertext"
            .DataSource = table2
            .DataPropertyName = "columnNameInTable1HoldingForeignKey"
 
            .ValueMember = "columnNameInTable2HoldingPrimaryKey"
            .DisplayMember = "columnNameInTable2HoldingComboBoxDescriptions"
            .Width = whatever...
        End With
        DGV1.Colums.Add(newCol)

Table 1 should have to foreign keys into Table 2, like:
IDKey  FKeyIn2  data1  data2
  1       1     "Hi!"  "There!"
  2       4     "More" "Data"


Table 2 should have the text descriptions you'll see in the CombBox like this:
IDKey  Description
  1    "Some text..."
  2    "Some more text..."
  3    "Another item"
  4    "Who cares"




Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: Using a ComboBox for a Cell in a DataGridView Pin
RichFeldman6-Apr-07 5:56
RichFeldman6-Apr-07 5:56 
GeneralRe: Using a ComboBox for a Cell in a DataGridView Pin
Dave Kreskowiak6-Apr-07 14:34
mveDave Kreskowiak6-Apr-07 14:34 
Questionabt help Pin
kripa215-Apr-07 1:19
kripa215-Apr-07 1:19 
AnswerRe: abt help Pin
nlarson115-Apr-07 2:01
nlarson115-Apr-07 2:01 
GeneralRe: abt help Pin
kripa215-Apr-07 2:27
kripa215-Apr-07 2:27 
QuestionUpdating Dataset Pin
nitin_ion5-Apr-07 1:18
nitin_ion5-Apr-07 1:18 
AnswerRe: Updating Dataset Pin
Dave Kreskowiak6-Apr-07 3:41
mveDave Kreskowiak6-Apr-07 3:41 
Questionhow to read dwg files (Autocad drawing file) from vb 6.0 Pin
saurabhmind5-Apr-07 0:30
saurabhmind5-Apr-07 0:30 
AnswerRe: how to read dwg files (Autocad drawing file) from vb 6.0 Pin
Christian Graus5-Apr-07 0:44
protectorChristian Graus5-Apr-07 0:44 
Questiondate and month r getting exchanged in MaskEdBox control. Pin
MissionSuccess5-Apr-07 0:19
MissionSuccess5-Apr-07 0:19 
AnswerRe: date and month r getting exchanged in MaskEdBox control. Pin
Christian Graus5-Apr-07 0:24
protectorChristian Graus5-Apr-07 0:24 
GeneralRe: date and month r getting exchanged in MaskEdBox control. Pin
MissionSuccess5-Apr-07 2:26
MissionSuccess5-Apr-07 2:26 
GeneralRe: date and month r getting exchanged in MaskEdBox control. Pin
Christian Graus5-Apr-07 9:28
protectorChristian Graus5-Apr-07 9:28 
AnswerRe: date and month r getting exchanged in MaskEdBox control. Pin
Member 38798816-Apr-07 1:18
Member 38798816-Apr-07 1:18 
Questiongetting ip address & computer name Pin
Sachin Pimpale4-Apr-07 23:52
Sachin Pimpale4-Apr-07 23:52 
AnswerRe: getting ip address & computer name Pin
Dave Kreskowiak6-Apr-07 3:39
mveDave Kreskowiak6-Apr-07 3:39 
GeneralRe: getting ip address & computer name Pin
Socheat.Net9-Apr-07 15:49
Socheat.Net9-Apr-07 15:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.