| | |
Datagridview question
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2007
Posts: 11
Reputation:
Solved Threads: 0
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:
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)
I am just wondering how i can sort the DGV by passing a value from the listbox.. here is my code:
VB.NET Syntax (Toggle Plain Text)
Private Sub lstCat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstCat.SelectedIndexChanged 'MsgBox("you selected " + lstCat.SelectedValue.ToString) Dim i As Integer i = lstCat.SelectedValue 'DGVShops.Sort(DGVShops.Columns(1), System.ComponentModel.ListSortDirection.Ascending) 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.
•
•
Join Date: Apr 2007
Posts: 11
Reputation:
Solved Threads: 0
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!
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!
![]() |
Similar Threads
- Implementing paging in pop window (C#)
- ComboBox question (C#)
- CStr() vs. toString() (VB.NET)
- How to create a global function/class ? (C#)
- DataGridView Column Cell Style Formatting (C#)
- checkbox in datagridview c# (C#)
- database question (C#)
Other Threads in the VB.NET Forum
- Previous Thread: Help make mobile imaging app
- Next Thread: Passing parameter to datagridview
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic bing browser button buttons center check code crystalreport cuesent data database datagrid datagridview date datetimepicker dissertation dissertations dissertationtopic dropdownlist eclipse excel fade file-dialog filter ftp generatetags google gridview hardcopy images input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters pdf picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial settings shutdown soap survey table tcp temperature text textbox timer timespan toolbox transparency trim update user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





