Click here to Skip to main content
15,898,374 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
Henry Minute28-Jul-09 8:32
Henry Minute28-Jul-09 8:32 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh28-Jul-09 8:41
KiwiDanChCh28-Jul-09 8:41 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
Henry Minute28-Jul-09 8:47
Henry Minute28-Jul-09 8:47 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh28-Jul-09 8:53
KiwiDanChCh28-Jul-09 8:53 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
Henry Minute28-Jul-09 8:55
Henry Minute28-Jul-09 8:55 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh29-Jul-09 0:05
KiwiDanChCh29-Jul-09 0:05 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh28-Jul-09 11:24
KiwiDanChCh28-Jul-09 11:24 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
Henry Minute29-Jul-09 5:18
Henry Minute29-Jul-09 5:18 
Hi, just got to my computer, I've been doing Banking, Shopping - you know - boring stuff like that.

Two things that you can try, while I am looking into this, and your other post.

First: This is just a general point. Whenever an event handler is used to handle a given event for more than one control you should use the sender parameter to determine which of the controls you are dealing with. In this particular case it doesn't matter but it is a good habit to get into.
So:
Public Sub OnComboIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim TheCombo As ComboBox = CType(sender, ComboBox)
    Dim strItemCode As String = Trim(TheCombo.Text) 'Value Of ComboBox
    ' This means that you always get the "Text" of the ComboBox that caused this event
    ' As I said above, in this particular case that is the same thing as HookedCombo, but that won't always be true

is preferred to:
Public Sub OnComboIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim strItemCode As String = Trim(HookedCombo.Text) 'Value Of ComboBox


Second:
Try changing:
If strItemCode = "Item 01" Then
      Dim i As Integer = DataGridView1.SelectedRows(0).Index
      DataGridView1.Rows(i).Cells(1).Value = "Item Description 01"
  End If

to:
      If strItemCode = "Item 01" Then    
            DataGridView1.CurrentRow.Cells(1).Value = "Item Description 01"
'The point is, and probably the reason you are getting the error, although you are 'using' a particular row
' it may not be selected and therefore won't appear in the SelectedRows collection. However CurrentRow
' always points at the row with the cursor in.
      End If


I'll have a look at your other post now, and I'll wait a bit before replying, assuming I have something to say of course Smile | :) , just in case the above works. Perhaps you'll let me know?

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh29-Jul-09 7:14
KiwiDanChCh29-Jul-09 7:14 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
KiwiDanChCh1-Aug-09 18:52
KiwiDanChCh1-Aug-09 18:52 
GeneralRe: DataGridView ComboBox VB.Net (Explaination) Pin
Henry Minute2-Aug-09 4:49
Henry Minute2-Aug-09 4:49 
QuestionImplementing a Read-Only 'File Open' or 'File Save' Common Dialog [modified] Pin
easy games26-Jul-09 2:58
easy games26-Jul-09 2:58 
AnswerRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Mike Ellison27-Jul-09 2:33
Mike Ellison27-Jul-09 2:33 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
easy games27-Jul-09 4:46
easy games27-Jul-09 4:46 
AnswerRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Dave Kreskowiak27-Jul-09 4:33
mveDave Kreskowiak27-Jul-09 4:33 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
easy games27-Jul-09 5:23
easy games27-Jul-09 5:23 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Dave Kreskowiak27-Jul-09 6:48
mveDave Kreskowiak27-Jul-09 6:48 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
easy games27-Jul-09 9:01
easy games27-Jul-09 9:01 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Dave Kreskowiak27-Jul-09 9:50
mveDave Kreskowiak27-Jul-09 9:50 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Mike Ellison27-Jul-09 10:22
Mike Ellison27-Jul-09 10:22 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
easy games28-Jul-09 20:57
easy games28-Jul-09 20:57 
GeneralRe: Implementing a Read-Only 'File Open' or 'File Save' Common Dialog Pin
Mike Ellison29-Jul-09 5:42
Mike Ellison29-Jul-09 5:42 
QuestionAttractive programs that use Windows Forms to build their GUI Pin
copec25-Jul-09 18:48
copec25-Jul-09 18:48 
QuestionMake Dialer Pin
Any_India25-Jul-09 2:01
Any_India25-Jul-09 2:01 
Questioncan dragdrop in a listview? Pin
neodeaths24-Jul-09 19:10
neodeaths24-Jul-09 19:10 

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.