[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

checkbox checked on selected index changed in combobox in a datagridview

Posted on 2009-03-31
12
Medium Priority
?
357 Views
Last Modified: 2012-05-06
I have a combobox with like 10 items and a checkbox in a datagridview...if the user selects certain items from the dropdown in a combobox, the chechbox need to be checked by deafualt..and it should be read only...how can i do this....

i tried this
 Public Sub cb_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

Select Case DataGridView1.CurrentCell.ColumnIndex

 Case 2
                Dim cell As DataGridViewComboBoxEditingControl = DirectCast(sender, DataGridViewComboBoxEditingControl)
                If cell.ValueMember = "abc" Then

                    ColReportReqd.Selected = True

                    ColReportReqd.ReadOnly = True

end sub
0
Comment
Question by:yuvaratna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 

Author Comment

by:yuvaratna
ID: 24033068
Colreportreqd is the name of the checkbox

Thsi is working fine but is there any property like checkbox1,checked=true ????

because the selected property is not the correct one to us in this context....
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 24033227
You can do this way:

Me.DataGridView1(Colreportreqd.Index, Me.DataGridView1.CurrentRow.Index).Value = True
0
 

Author Closing Comment

by:yuvaratna
ID: 31565037
Excellent..Thanks a lot ..YOu solved three of my Problems today!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:jpaulino
ID: 24033327
Glad I could help :)
jpaulino
0
 

Author Comment

by:yuvaratna
ID: 24033344
Just a small question on the line "  If cell.ValueMember = "abc" Then"  istead of "abc", i wanted the checkbox to be checked if the user selectes certain items from the drop down...so for the column "colreportreqd" , i had the display member as column say column a from the database...it has only two values 'Y' and 'N' ...so if the value of the selected item is 'Y' then i wanted the checkbox to be checked....

so what is the property that is used to get the value of the selected item....
0
 

Author Comment

by:yuvaratna
ID: 24033364
not the display member ...the value member is bound to a column say column a, which has only two values 'Y' and 'N' ...so if the value of the selected item is 'Y' then i wanted the checkbox to be checked....

so what is the property that is used to get the value of the selected item....
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24033401

Not sure ... you have

nameA      Y
nameB      Y
nameC     N
and you're usign valuemember and displaymember to store it ?
0
 

Author Comment

by:yuvaratna
ID: 24033434
yup! thats what i am doing....one column is bound to the display meber and the other column to the value memvber.the value member column has only tow values 'Y' and 'N' ...so what i wanted to do is if the valuemember of the selected display member is 'Y' , i wanted to check the checkbox and make it read only...

Now everything is working fine...but i checked it for a particular iitem...with display member "abc" ..
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24033517
Running fine now, right ?
0
 

Author Comment

by:yuvaratna
ID: 24033535
let me put the problem more clearly....
0
 

Author Comment

by:yuvaratna
ID: 24033566
i have

 ColPurpose.DisplayMember = colpurposedisplaymember
        ColPurpose.ValueMember = colpurposevaluemember

where colpurpose is the combobox, ...the value member just has two values 'Y' and "N' ...what i want is if the valuemember is 'Y', i want checkbox to be checked...
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24033660
You're doing right, you just have to change If cell.ValueMember = "abc" to If cell.ValueMember = "Y"
... or I'm not getting the point
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question