Search:

Type: Posts; User: rafter_01

Page 1 of 4 1 2 3 4

Search: Search took 0.02 seconds.

  1. Re: Change behaviour datagridview cell when the form loads?

    update:

    JMC, you'll probably lambast me for this but i somehow got this working with the following code under the form load event:



    For Each row As DataGridViewRow In...
  2. Re: Change behaviour datagridview cell when the form loads?

    better late than never..

    ill crack on with the next part now and will post what ive done..

    thanks JMC
  3. Re: Change behaviour datagridview cell when the form loads?

    integer type..
  4. Re: Change behaviour datagridview cell when the form loads?

    right,

    is this what you meant:

    Private Sub SetCellBackColors(ByVal rowindex As Object, ByVal columnindex As Object)


    Dim cell As DataGridViewComboBoxCell =...
  5. Re: Change behaviour datagridview cell when the form loads?

    JMC,

    not done a 'for loop' before, can you please help me with the code?

    googled it but not entirely sure how i implement this in form load.

    understand that i need to loop for the row index
  6. Re: Change behaviour datagridview cell when the form loads?

    and i'm calling the method in cellvaluechanged event handler:

    SetCellBackColors(e.RowIndex, e.ColumnIndex)

    and tested this event handler and it works the same way.. brilliant.. onto the next...
  7. Re: Change behaviour datagridview cell when the form loads?

    sorry got a million things going on, i got confused between variables + parameters, is this better:


    Private Sub SetCellBackColors(ByVal rowindex As Object, ByVal columnindex As Object)


    ...
  8. Re: Change behaviour datagridview cell when the form loads?

    hey thanks for your reply, created a method:


    Private Sub SetCellBackColors()

    Dim columnIndex As ????
    Dim rowindex As Integer ????

    If rowindex <> -1 AndAlso...
  9. Re: Change behaviour datagridview cell when the form loads?

    one step at a time:

    to loop through for the row index, is the following code correct:


    For Each row As DataRow In DataGridView1.Rows

    Next row

    now how would i add this to the...
  10. Re: Change behaviour datagridview cell when the form loads?

    oh ok cool.. bit over my head this is..
  11. Re: Change behaviour datagridview cell when the form loads?

    JMC,

    with your kind help, the following code was created:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles...
  12. Re: Change behaviour datagridview cell when the form loads?

    previously you helped me with changing a combobox cell color when the value was changed. Just wanted to do something similar. Such as automatically set the color of a cell depending on the value when...
  13. Change behaviour datagridview cell when the form loads?

    Morning,

    if i want to make a change to a cell in a datagridview when the form loads, how would i go about doing this?
  14. Re: VS2008:How do i access the datagridview combobox selected Index?

    Niya,

    apart from putting the code in the form load instead of VALUECHANGED event, im pretty sure the only modification i need to make is with this line:


    Dim cell As DataGridViewComboBoxCell =...
  15. Re: VS2008:How do i access the datagridview combobox selected Index?

    yes..

    but i want to do this when the form loads. So when the form loads if the combobox value is 'paid' then show the cell color green and if its 'unpaid' then red.
  16. Re: VS2008:How do i access the datagridview combobox selected Index?

    with the help of JMC, the code i created to change cell color based on value is:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As...
  17. Re: VS2008:How do i access the datagridview combobox selected Index?

    to get to the cell ive used the following code for VALUECHANGED event:


    Dim cell As DataGridViewComboBoxCell = DataGridView1(e.ColumnIndex, e.RowIndex)

    how would i get to the cell if i want it...
  18. Re: VS2008:How do i access the datagridview combobox selected Index?

    oh ok cool,

    im doing something similar to this by changing the color of one my textbox columns but can't seem to get it to work:


    Dim thirdColumn As Integer = 1
    Dim column As...
  19. Re: VS2008:How do i access the datagridview combobox selected Index?

    No problems Niya, that works many thanks...

    now that i can get the datagrid combobox to change color when i select something, what if i wanted to show "Unpaid" to be green and "Paid" to be red...
  20. Re: VS2008:How do i access the datagridview combobox selected Index?

    Niya, any update on this?
  21. Re: VS2008:How do i access the datagridview combobox selected Index?

    sorry got it working now:

    line missing was:


    If retrievedValue = False Then

    ......

    JMC thankyou for your help throughout this thread.
  22. Re: VS2008:How do i access the datagridview combobox selected Index?

    thanks JMC, changes made:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged

    ...
  23. Re: VS2008:How do i access the datagridview combobox selected Index?

    Right JMC, hope ive got this right, dont wanted to be slated:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)...
  24. Re: VS2008:How do i access the datagridview combobox selected Index?

    cool, so far my code looks like this:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles...
  25. Re: VS2008:How do i access the datagridview combobox selected Index?

    is the type: DataGridViewComboBoxCell

    found the info from: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.items.aspx
  26. Re: VS2008:How do i access the datagridview combobox selected Index?

    thanks .Paul
  27. Re: VS2008:How do i access the datagridview combobox selected Index?

    btw, ive just noticed the following error is what i get when running just the above code:


    An error occurred creating the form. See Exception.InnerException for details. The error is: Index was...
  28. Re: VS2008:How do i access the datagridview combobox selected Index?

    is it integer type?
  29. Re: VS2008:How do i access the datagridview combobox selected Index?

    I'm kind of lost at this point, you make the point that the cell bit is:


    DataGridView1(e.ColumnIndex, e.RowIndex)

    firstly am i doing the conversion right? what type will my variable be?

    ...
  30. Re: VS2008:How do i access the datagridview combobox selected Index?

    okay coz the value in that cell is a string value would my variable be?:


    Dim value As String = e.ColumnIndex
  31. Re: VS2008:How do i access the datagridview combobox selected Index?

    Hi,

    what type of variable would i assign the cell to? Also, would i create this variable within the CellvalueChanged event?
  32. Re: VS2008:How do i access the datagridview combobox selected Index?

    JMC, quite frankly tbh, i got this little example of code from the net and the guy who posted it explained it by breaking it down, i understood it much quicker... but no doubt you're very helpful and...
  33. Re: VS2008:How do i access the datagridview combobox selected Index?

    what ive done so far:


    Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged

    ...
  34. Re: VS2008:How do i access the datagridview combobox selected Index?

    Just read this, thanks for your reply.

    What you're actually asking for is not an example but for someone to write a copy and paste solution for you. That someone won't be me.

    i completely...
  35. Re: VS2008:How do i access the datagridview combobox selected Index?

    been looking at this all afternoon but still struggling, JMC i understand what you're saying but im fairly new to VB so struggling to execute what you are trying to say..

    can someone please post...
  36. Re: VS2008:How do i access the datagridview combobox selected Index?

    thanks for this info,

    possible you can show me an xample?
  37. Re: VS2008:How do i access the datagridview combobox selected Index?

    understand your explanation but not sure if i'm coding it right:


    Dim test As New DataGridViewComboBoxCell

    test = Column1.DataSource

    If test.DisplayMember = "Paid" Then
    ...
  38. VS2008:How do i access the datagridview combobox selected Index?

    Afternoon,

    how do i get the selectedindex/item of a datagridview combobox column?

    what i want to do is change the back color of datagridcombobox when something is selected from the combobox?
    ...
  39. Replies
    7
    Views
    680

    Re: Datgridview Selections

    hah, thanks for this.

    so just say i wanted to update 'column1' of the selected rows from one to word to another for example "one" to "two". Would i use the row.index as a reference?
  40. Replies
    7
    Views
    680

    Re: Datgridview Selections

    oh ok and through code how would i refer to the selected rows?
Results 1 to 40 of 144
Page 1 of 4 1 2 3 4



Click Here to Expand Forum to Full Width