Datagridview question

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 11
Reputation: Fritzeh is an unknown quantity at this point 
Solved Threads: 0
Fritzeh Fritzeh is offline Offline
Newbie Poster

Datagridview question

 
0
  #1
Apr 2nd, 2008
Hi, after problems with using checkedlistboxes and the rest. I decided to take an easier route and use a listbox which i have populated from a database. It contains text with values assigned to it. i also have a DGV with 4 columns. The column i wish to sort by contains integers only.

I am just wondering how i can sort the DGV by passing a value from the listbox.. here is my code:

  1. Private Sub lstCat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstCat.SelectedIndexChanged
  2. 'MsgBox("you selected " + lstCat.SelectedValue.ToString)
  3. Dim i As Integer
  4.  
  5. i = lstCat.SelectedValue
  6.  
  7. 'DGVShops.Sort(DGVShops.Columns(1), System.ComponentModel.ListSortDirection.Ascending)
  8. End Sub

The msgbox was for testing the values are correct.
i is supposed to equal the value of selected index (which is fortunately the same as the CatID will be i want to sort by)

The last line just sorts it in ascending, but i would like to sort the column by whatever given value (2,3,4, etc)
Last edited by Fritzeh; Apr 2nd, 2008 at 11:30 am.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 11
Reputation: Fritzeh is an unknown quantity at this point 
Solved Threads: 0
Fritzeh Fritzeh is offline Offline
Newbie Poster

Re: Datagridview question

 
0
  #2
Apr 2nd, 2008
I am also having problems trying to use a textbox to search for a value in the name column.

1. User types "String" into txtbox
2. press ok
3."String" passed to DGV/dataset/bindingsource/what?
4. Datagridview displays reults with "string" in the set column. only.

My main problem is i dont know how to pass the data to, whatever im passing it to. the above problem is similar surely, just using an integer instead of a string.

please help!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC