Click here to Skip to main content
13,734,245 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi to all

I have a datagridview with 1 combobox and 2 textbox

i want when the user update the combobox the program fill the first textbox.

I have the code for validation but i dont know how to take the value of the combobox

Private Sub dataGridView1_CellValidating(ByVal sender As Object, ByVal e As DataGridViewCellValidatingEventArgs) Handles Movement_roller_DDataGridView.CellValidating

    Dim headerText As String = _
        Movement_roller_DDataGridView.Columns(e.ColumnIndex).HeaderText

    ' Abort validation if cell is not in the CompanyName column.
    If Not headerText.Equals("Κωδικος Roller") Then Return

    ' Confirm that the cell is not empty.
    If (String.IsNullOrEmpty(e.FormattedValue.ToString())) Then
        Movement_roller_DDataGridView.Rows(e.RowIndex).ErrorText = "Ο Κωδικώς Roller δεν μπορεί να είναι κενός"
        e.Cancel = True
    End If
End Sub
Posted 27-Apr-11 9:52am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Go through the folllowing link will help you

Getting-Selected-Value-Combo-Box[^]
  Permalink  
Comments
Vagelisr 28-Apr-11 9:36am
   
Hi and thanks for the post.... but in this examples you have send to me they did not help me at all
I want in my combobox to show the description and to get the id .
If i want to take back what combobox show in my code i will have to add an else in the If (String.IsNullOrEmpty(e.FormattedValue.ToString())) Then and show the e.FormattedValue.ToString
i want in my combobox to show the description and take back the id.
and

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 28 Apr 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100