Refreshing Listbox Without Loosing Selected?
Dec 28, 2009
Ok, So I have this prettey simple code to get the window titles of all running programs:
lstTitles.Items.Clear()
For Each p As Process In Process.GetProcesses
If p.MainWindowTitle = "" Then
[code]......
View 6 Replies
ADVERTISEMENT
May 10, 2011
I have two dropdownlist, one is State and one is City. When a State is selected, the City dropdownlist becomes populated. At that point you can select a city, however if you select a city and go back and select a different state, the city dropdownlist is populated by the cities for both states. How do I get it clear the cities for the first state?
Here is the code behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
[Code].....
View 1 Replies
Feb 9, 2012
I have Listbox, that I want to assign primary key, and a text (eg. students table). So i wrote this code.
mySQLCmd.CommandText = "SELECT studentname, studentid FROM studentstable WHERE Year(DOB) = " + selectedYear
Dim dt As New DataTable
myReader = myCmd.ExecuteReader()
[code]....
When I select something on the listbox, both of selecteditem and selectedvalue properties just return the student name, not the student id. So I get this error.
Error on Line2. Conversion from string "RichardCole" to type 'Integer' is not valid.I don't know why? So i do i get the studentid value back ? I need to know the ID coz name can't use as PK so.
View 2 Replies
Aug 18, 2010
I have multi select set to false and get this error
InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: index
vb.net
Private Sub MembersList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MembersList.SelectedIndexChanged
Try
[Code].....
View 1 Replies
Jan 27, 2009
I have a form with a list box and a button. The list box is filled with text files from a folder. When you click the button whatever file is selected in the list box is then opened and each line of that file is added as an item in a list box on another form.I'm not sure what to code for if something in the first list box is not selected.
View 5 Replies
Feb 10, 2012
I've being trying to work out a problem i've being having for a while now and i'm not sure if i'm over complicating it.When a form loads, it uses a for next loop to load an array of peoples names into a list box. However i want to extract the persons ID once their name has being clicked. I can make this work by using another for next loop until the selected name matches the an array number. However it fails if there are two people of the same name.Is there a command or piece of code that can extract the row number of the item selected?
View 3 Replies
Dec 6, 2010
The sample below does what I want it to do and that is once I've filled the maskedtextbox and press enter it goes and does stuff. However, because the maskedtextbox is full I get an annoying 'beep'. So I figured I'd just use the tab key, I changed theChrW(Keys.Return) to ChrW(Keys.Tab) but it doesn't fall through, it just changes focus to the next maskedtextbox that I have. Is there a way to lose the beep? Or how do I get the tab key to fall through?
[Code]...
View 5 Replies
Jan 11, 2010
I have a datagridview. If the user adds a new row, and then clicks away from the grid. How can i stop them from doing this?
I want them to finish the row add first or cancel it. I want to then update the table adapter in the grid's leave event.
If the row validation fails, i want to display a message and re-focus to the cell in question.
The first problem i am running into is that the focus continues to go to the control that the user clicked on to move away from the grid.
How do i cancel that event?
As an example, if the grid is on a tab page and the user clicks on another tab page, i want to prevent that page from displaying if there is an error on the row that is being added to the grid.
I was hopeing for a cancel option in the lost focus event of the grid.
View 4 Replies
Mar 29, 2010
That works fine, but the highlighted line creates a new bitmap, so the exif metadata are not exported to the resized image.
Is there a way to resize a picture without loosing exif data?
Creating a new bitmap with the new size is the only way to resize a picture?
View 2 Replies
Aug 10, 2009
My code follows. I have six items (indices 0-6) and I'm trying to check if one has been selected or not. If not, then messagebox yells at you to select one. If it does, it tells you what you have selected. I'm having a horrible brain fart and contemplated coming here for about 45 minutes as I couldn't get it.
If ListBox1.SelectedItem.ToString <> "" Then
MessageBox.Show("You selected " + ListBox1.SelectedItem.ToString)
Else
MessageBox.Show("Please select an item.")
End If
View 2 Replies
Apr 15, 2009
In .NET there doesn't seem to be a property to find the item just selected in a multi-select listbox; SelectedIndex always shows the first selected item. From memory VB6 had the ListIndex property that changed accordingly... Why remove a useful property ?
Duplicate: How to get the last selected item in multiselect ListBox?
View 2 Replies
Mar 6, 2009
There is a listbox whith SelectionMode set to MultiExtended and it has multiple items selected.[code]...
View 8 Replies
Jul 15, 2010
I need to cancel the selected item in the listbox if the number of selections exceeded from max number the user has defined. What should I do?
View 6 Replies
Jul 18, 2010
I need a way of converting the listbox.selectedindex into hex and then writing it to a file(The writing is done using PackageIO.writer). The weird thing is the code i use works for most of it but on some of the writes and conversions it just converts the selectedindex to 00 when its not.
Dim Writer As New PackageIO.Writer(Filepath, Endian.Little)
Writer.Position = &HE24A
Writer.WriteUInt16(Convert.ToByte(ListBox3.SelectedIndex))
[code]....
View 25 Replies
Nov 25, 2006
How can I delete all the selected items in a multi-select listbox in VB.NET?
View 4 Replies
Nov 19, 2011
I have the below code that works great, until you have multiples of the same thing.example of data
burger
-tomato
+tomato[code].....
if i select the +tomato in wrap it remmoves the +tomato in burger (deleting the 1st oocurance of it) how can i fix that. i have played alot and can not figure it out.(ps the other list boxes are other data but it needs to remove the same "line" as each other. they are all changed to the same selected index when 1 is changed)
Dim value As String
Dim value1 As String
Dim value2 As object[code].....
View 21 Replies
Jun 21, 2010
What im trying to do is display my details in a listbox then the one that is selected frm the listbox is displayed in the textboxes and when delete button is clicked it is flagged at deleted??? This is what should happen!!:@
I kow there is definitely a problem with this piece of code im setting the index and length to constant numbers so if a different name is clicked it does not work!! is there another way to set this to allow for any length or index position??
CustomerIDTextBox.Text = DisplayCustomersListBox.Text.Substring(0, 4)
SurnameTextBox.Text = DisplayCustomersListBox.Text.Substring(5, 7)
ForenameTextBox.Text = DisplayCustomersListBox.Text.Substring(12, 10)
[Code].....
View 5 Replies
Apr 23, 2010
have this code here:
Dim decSubTotal As Decimal
Public g_selected As Integer
'dvd titles
[Code].....
View 6 Replies
Nov 8, 2007
So, I need to be able to edit an item that has been selected in a listbox. I need to do so with a button click event. Theoretically, I know how to do this, because I know how to add an item, and how to remove one, and how to insert an item at a specific location.
'Dim strinput As String
'Dim Item As Object
'Dim index As Integer = lstList.Items.IndexOf(item)
'strinput = InputBox("Edit This Item")
'lstList.Items.RemoveAt(lstList.SelectedItem)
'lstList.Items.Insert(index, strinput)
however, this does not work at all. what am I doing wrong??
View 4 Replies
Oct 10, 2011
I have loaded datatable to listview.Now when i try to do a selected index and retrieve data to display in respective text box. I find some error "input string format incorrect".but when i directly load from folder it works fine.
Data that retrieved from Datatable.Im not able to find the index of the row. But from folder and listed in ListView.Index value is found.
Dim breakfast As ListView.SelectedListViewItemCollection = Me.LOV.SelectedItems
For Each item1 In breakfast
index += Double.Parse(item1.SubItems(1).Text)
Next
View 2 Replies
May 13, 2009
I have two listboxes in asp.net. On the click of a button I want to load a list box with the elements of the selected items in the other box. The problem is that this has to be done on the client side because when the button is clicked I don't allow it to submit. I want to call a javascript function onselectedindexchange but that is [code]...
View 3 Replies
Nov 15, 2009
am selecting data from one list box to the other and rigth now have only been able to select the data one by one but i want to click on a button and the it takes all data in one list box to other listbox This is my code
If Me.lstballaplicants.SelectedItem = "" Then
MessageBox.Show("No Selected Or Registered Applicant")
Exit Sub
[code].....
View 2 Replies
May 3, 2009
How to check whether the listbox contain selected item or not in vb.net.
View 8 Replies
Aug 2, 2011
I am coding a simple database that uses a .txt file as a way to store infomation (It is required to use an external file and .txt was the first one that comes to mind), my question was. Is there a way to click on data in a list box and then delete it from both the listbox and the .txt file?
View 4 Replies
Dec 13, 2011
I am trying to use a listbox to hold categories from one table in a database and by clicking on the categories in the listbox it will display data from another table in the database that is linked to those categories. One table has a field called ID and the other has categoryID and categoryID is linked to ID so it displays the numbers from ID.I am using this:
daSamples.SelectCommand.CommandText = "SELECT * FROM tblSamples WHERE tblSamples.categoryid =" & (lstCategory.SelectedIndex + 1)
daSamples.Fill(dsSamples, "tblSamples")
Currently, however with this if you delete a category from the table with ID in it then it changes the values of the selectedindex in the listbox which messes up the data that gets displayed. How can i change this so instead of using the selectedindex from the listbox, it takes the ID from the selectedindex?
View 2 Replies
Mar 23, 2011
Im trying to get a webpages selected item in a listbox. I was able to get what I could from the textboxes using the htmlelementcollection, but when I try to get what is inside a listbox nothing comes up.
Code:
Dim theElementSelection As HtmlElementCollection = Form1.wbCHCTrac.document.GetElementsByTagName("Option")
For Each currentElement as HtmlElement in theElementCollection
Dim controlName As String = currentElement.GetAttribute("Value").ToString
if controlName = "Selected" then
controlname = currentElement.GetAttribute("Value").ToString
[Code] .....
View 2 Replies
Jul 2, 2010
Iv been trying to figure this out for hours ok so basically i need a to check if there is an item selected in listbox1Heres the code in trying to make work
If ListBox1.SelectedItem = True Then
ListBox2.Items.RemoveAt(ListBox1.SelectedIndex)
ListBox3.Items.RemoveAt(ListBox1.SelectedIndex)
[code]....
View 5 Replies
Apr 21, 2009
I know this is simple but hard for me xD. Opening a msgbox when a listbox item is clicked. [code] It MUST contain the msgbox.
View 4 Replies
Aug 10, 2011
I have a quick question...is it possible to make a "for... each" loop that would go through each selected item of a listbox? What I want to do make sure there are no dupe names in the listbox.
View 2 Replies
Oct 22, 2009
I am binding my listbox to a dataTable, the reason why i am using a listbox is for multiple selection, the user can select more that 1 item, when the user has selected there items, i need to save them into the db, line after line. heres my code, i cannot get the listbox to display all the selected items in my test page.for now in my test page, i just want to show the selected indexes of the items, and then in my next step i would want to add then indexes to the database, for now i just want to loop and display all the selected indexes.
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'1. Create a connection
Dim conn As New MySqlConnection(ConfigurationManager.ConnectionStrings("MyConn").ConnectionString)
Try
[code]....
View 2 Replies