How to check which item is selected in a datagridview combobox?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 2055 Views - Last Post: 31 January 2013 - 02:39 AM Rate Topic: -----

#16 thanzeem7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 14-January 13

Re: How to check which item is selected in a datagridview combobox?

Posted 29 January 2013 - 11:22 PM

@ kai_itz me -- I don't know what happened. I give the column index 0. Its working properly.
ATCGRID.Rows(x).Cells(0).EditedFormattedValue.ToString()

Was This Post Helpful? 0
  • +
  • -

#17 kai_itz me  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 159
  • Joined: 03-August 12

Re: How to check which item is selected in a datagridview combobox?

Posted 29 January 2013 - 11:38 PM

I REALLY DONT KNOW THE PRCEDURE HOW THE ABOVE CODE IS GOING TO WORKS.. BUT IF THAT ONE IS WORKING FOR U THAT IS REALLY GOOD..

BUT I THINK THE PREVIOUS CODE I PROVIDED SHOULD ALSO WORK FOR YOU. HAVE U TRIED THAT ONE.

Dim status As Double 

     For x As Integer = 0 To 4  

         If ATCGRID.Rows(x).Cells(2).Value = "Full" Then 

             status = 1  

         ElseIf ATCGRID.Rows(x).Cells(2).Value = "Empty" Then 

             status = 0  

         ElseIf ATCGRID.Rows(x).Cells(2).Value = "Half" Then 

             status = 0.5  
            else
            
          status = 2
         End If 
         MessageBox.Show(status)  






IF NOT, PLESE TRY AND TELL ME WHAT ERROR U GOT SO I CAN COME TO KNOW WHAT THE ACTUAL PROBLEM IS THANKS

This post has been edited by kai_itz me: 29 January 2013 - 11:39 PM

Was This Post Helpful? 0
  • +
  • -

#18 thanzeem7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 14-January 13

Re: How to check which item is selected in a datagridview combobox?

Posted 31 January 2013 - 02:39 AM

View Postkai_itz me, on 29 January 2013 - 11:38 PM, said:

I REALLY DONT KNOW THE PRCEDURE HOW THE ABOVE CODE IS GOING TO WORKS.. BUT IF THAT ONE IS WORKING FOR U THAT IS REALLY GOOD..

BUT I THINK THE PREVIOUS CODE I PROVIDED SHOULD ALSO WORK FOR YOU. HAVE U TRIED THAT ONE.

Dim status As Double 

     For x As Integer = 0 To 4  

         If ATCGRID.Rows(x).Cells(2).Value = "Full" Then 

             status = 1  

         ElseIf ATCGRID.Rows(x).Cells(2).Value = "Empty" Then 

             status = 0  

         ElseIf ATCGRID.Rows(x).Cells(2).Value = "Half" Then 

             status = 0.5  
            else
            
          status = 2
         End If 
         MessageBox.Show(status)  






IF NOT, PLESE TRY AND TELL ME WHAT ERROR U GOT SO I CAN COME TO KNOW WHAT THE ACTUAL PROBLEM IS THANKS


Yes buddy.. The same code is working with me. But the index need to change.... Cell(0) for Status, Cell(1) for Remark, Cell(2) for ID and Cell(3) for Name in my DataGrid View..
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2