VS 2008 : Send The Number In The Selected List Item To A Variable So Only "0", "14", "15", "16", Etc?

Jan 12, 2010

I have a list, and in my items are labeled like this:

"Work sound ex 0"
"Work sound ex 0"
"Home sound ex 14"
"Home sound ex 15"
"Home sound ex 16"

How can I just send the number in the selected list item to a variable so only "0", "14", "15", "16", etc. is sent and not the words like "home" or "sound"?

View 3 Replies


ADVERTISEMENT

VS 2008 Send Selected Item Of List Box Onwards?

Mar 22, 2010

i have a listbox (listbox1) which is populated via the user selecting a folder and the listbox1 displays all the subfolders of that folder, and a second list box (listbox2) which display all the files within the folder selected in the 1st list box.

And i have a checksum scanner on the same form, which when the 'scan' button is clicked i want to scan the listbox2 selected item, but i cant seem to get it working, heres my

Private Sub scan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCrc.Click
Dim c As New CRC32()

[Code]....

View 25 Replies

VS 2008 - Storing Selected Item In ComboBox To Variable On Button Click

May 10, 2010

I have 13 variables, all called Items1, Items2, Items3 and so on. I have a combo box with items in, each time I click a button I want it so whatever is selected is stored in a variable and if the button is selected again then it stores whatever is selected in the next variable. I know all the code for selecting items in a combo box and transferring it to a variable but the problem I cannot do is the part where each time a button is clicked it stores whatever is selected in the combo box to the next variable.

View 9 Replies

Get Selected Item Index Or A Sorted & Grouped List Relative To Item Source?

Feb 12, 2011

I'm having some difficulty with a sorted & grouped listbox in WPF vb.net 3.5 that has an items source bound to an ObservableCollection.

What I want to be able to do is to retrieve a piece of data from the ObservableCollection items source depending on what item in the listbox the user has selected.I've almost got it working but because the listbox is sorted it does not match the index of the items source.

[code]...

As I previously mentioned, because the lstBox is sorted and also grouped the index's don't match up.Does anyone know how I can get the correct information I want from the List Source depending on the selected item in the list box?

View 3 Replies

How To Get The ID Number Of A Selected Item In Listbox

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

Get The Index Number Of The Selected Listview Item?

Jan 31, 2011

I have set my listview multiSelect = false, view = details , FullRow select = true , HideSelected = False. I have one coulumn which has 10 items . I want to get the selected row index in vb.net

View 2 Replies

Getting The Index Number Of Selected ComboBox Item?

Feb 6, 2010

I have a combo box setup with 4 items, with indexes ranging from 0 to 3.

Later in my code, I need to do a certain event depending on what is selected. To do this I thought about comparing what the index of the selected combo box item is, because integer comparison is faster than strings, right?

how I can grab the index of the selected value?

View 3 Replies

Increasing Number After Next Combobox Item Selected?

Feb 13, 2012

What I want to do here is to increase the number on a label for next combobox item selected

eg.

Items Label
Tom 1
Jane 2
Mary 3
John 4
etc.. etc..
etc.. etc..
etc.. etc..

View 2 Replies

Have The Index Value Of A Selected Item In A Combobox Returned To A Variable?

Jan 20, 2010

I am trying to have the index value of a selected item in a combobox returned to a variable. Then, if the variable = 1 (which would be the index of th second item in the combobox), I want a groupbox to be hidden (be invisible) on the form. Here is my code...Getting an error that says:

'ListIndex' is not a member of 'System.Windows.Forms.ComboBox'

Code:
Private Sub cbxAccounts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim selection As Integer = CInt(cbxAccounts.ListIndex)
If selection = 1 Then gbxCheck.Hide()
End Sub

View 14 Replies

Index Value Of A Selected Item In A Combobox Returned To A Variable

Jan 20, 2010

I am trying to have the index value of a selected item in a combobox returned to a variable. Then, if the variable = 1 (which would be the index of th second item in the combobox), I want a groupbox to be hidden (be invisible) on the form. Here is my code...Getting an error that says:[code...]

View 1 Replies

Take The Text In The Selected Item Aand Save It Into Variable?

May 1, 2009

i set the datasource property of my combobox to datatable and ofcourse the displaymember and value member and now i want to take the text in the selected item aand save it into variable? i tried this

dim x as string=nothing x=combobox1.selecteditem.tostring but it is returned datarowview so what i must do??

View 3 Replies

Send A Not Selected Value In A List Box To String?

May 2, 2010

I'm trying to make a scheduling tool for my major at my school and I have a CourseEntryForm, RemainingCoursesForm and CoursesCompeltedForm.The CourseEntryForm has list boxes of courses that are required for graduation. I have been able to send the selected values of these list boxes to rich text boxes in the CoursesCompletedForm, however I need the courses that have not been selected in the list boxes to be sent to string that I can use in rich text boxes in the RemainingCoursesForm.I have tried using:ListBox.Items.ToString(RemainingCourses)when RemainingCourses is declared as string. I have also tried If statements to try to assign it, but I can never get it to work properly.

View 1 Replies

Get Selected Item From A List?

Aug 3, 2010

i have a sub that checks all drives on a computer;

Dim getInfo As System.IO.DriveInfo()
getInfo = System.IO.DriveInfo.GetDrives
For Each info As System.IO.DriveInfo In getInfo
TextBox1.Text = TextBox1.Text & info.Name & vbCrLf
Next

this shows all drives in textbox1. now if i select the drive i want, i can then check the free & total space with this sub;

Dim cdrive As System.IO.DriveInfo
cdrive = My.Computer.FileSystem.GetDriveInfo(TextBox1.SelectedText)
TextBox2.Text = TextBox1.SelectedText & " has " & cdrive.TotalSize / 1024 / 1024 / 1024 & "gb total space" & vbCrLf
TextBox2.Text = TextBox2.Text & "and " & cdrive.TotalFreeSpace / 1024 / 1024 / 1024 & "gb free space"

all this is good if i select the drive i want to check. but if i only click the drive, since no text is selected, the second sub does not work.is there a way to check at which index the cursor is, grab the item of the index, and pass it to the sub so i don't have to select the text itself?

View 6 Replies

Inserting An Item Above Selected In A List Box?

May 31, 2009

can't seem to find the answer to this anywhere.I need to know how to add an item in a list box above the currently selected item. I know there is a RemoveAt function which removes selected but is there any way to control where an item is added?

View 7 Replies

List Box Item Selected Status?

Jul 2, 2011

I have a list box that contains some values. I want to checked just whether any of the item from tha list has been selected or not? If selected output should be true otherwise false.

View 3 Replies

Make Item In List Box Appear Selected

Nov 10, 2009

I'm trying to figure out a code to do the following:If the item is found in the list box, make the item in the list box selected.

View 8 Replies

Split A Selected Item In A List Box?

Nov 23, 2010

I'm having a problem with a program I am re-making. I used to be quite good at this stuff but I stopped and now I've pretty much forgotten everything. In hopes of gaining my knowledge back, I wanted to remake a program I made years ago but I'm having a problem.

I'm trying to split a selected item in a list box. This is what the item looks like:

|DATA|DATA|DATA|DATA/ELSE|

I can split it fine using this code:

Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
Dim LineofText As String

[Code].....

View 8 Replies

Verifying That An Item Is Selected In List Box

Feb 14, 2011

in VB10 Express is there a way to verify that something in a list box has been selected BEFORE an action can be taken? I was debugging and found an unhandled error when I accidentally told the program to do something, but there was nothing selected.

View 2 Replies

Get The Highlight Of All Selected Item In List View?

May 30, 2012

Hi is there a way I could keep the highlight of all selected item in list view. every time listview lost focus it's gone?

View 1 Replies

Navigating Selected List View Item?

Feb 24, 2011

I'm currently creating a tabbed browser. Everything works fine as i expected. When it comes to history, I'm excepting a difficulty to navigating items from list view.

View 4 Replies

Transfer Item Selected In A List Box To A Label In .Net?

Mar 15, 2011

I am trying to select an item in the listbox (e.g. January) and retrieve the number of days to display in the label. Have listbox (listMonth) created but cannot seem to add the data ("31") to show in the label box(lblDays.text) when January is selected.

Public Class MonthDay
'Declare global variables
Dim Jan As String = "31"
Dim Feb As String = "28 or 29"

[code].....

View 3 Replies

Count The Number Of Times A Button Is Pressed While An Item Is Selected From A ListBox?

Feb 8, 2012

The List Box has three candidates and a record Button. Every time the record button is hit I need it to add those button clicks for each candidate that is selected in the List Box. My code keeps counting all the clicks no matter which candidate I am selecting in the List Box. How can I differentiate between each selected item in the List Box. Here is an image of how the application should look: [URL] Public Class Form1

[Code]...

View 1 Replies

Edit The Selected Item Of The ComboBox's DropDown List?

Mar 7, 2010

I have a comboBox that is populated with a dataset. The values are:

KG - Kilograms
LB - Pounds
and so on.
So when the user clicks the comboBox in the DropDown the user will see:
KG - Kilograms
LB - Pounds
and so on.

[Code]...

View 3 Replies

Forms :: Display The Selected Item From A List Box In To A Label?

Dec 10, 2009

I have items in a listbox. the user have to select one item(its mandatory) and after have to click next button to proceed to the next form. in the second form the selected item should be displayed in a label.

View 6 Replies

Handling Enter Key Event On List Box Selected Item?

Oct 16, 2009

I have created VBA form in which I have list box and few buttons. I want to handle the enter key event when some one has selected some item from list box and pressed enter. If I can make some specific button click event default for enter key then also fine.

View 4 Replies

PositionChanged Does Not Fire For Listbox When The 1st Item In The List Is Selected?

Feb 9, 2011

My listbox is bound to a datatable. The listbox is initially set to not show any data using selectedindex = -1.I have a second listbox that populates based upon the entry selected in listbox1. I use the Bindingsource PositionChanged event to populate the 2nd listbox.My problem is when the 1st entry in the listbox is selected the PositionChanged event does not fire, because the row selected is the default current position of the bindingsource. Can the Bindingsource be set to a "Null" position, I tried Position = -1 and that has no effect.

View 3 Replies

Programmatically Add A Drop Down List In Asp.net With Specific Pre-selected Item?

Nov 30, 2011

I've worked out how to create a DropDownList using the following code: <select id="salesPersonDropList" runat="server"></select> In my .aspx page, then my code behind loops through database output running:

Dim newListItem As ListItem
newListItem = New ListItem("Title", "Value")
salesPersonDropList.Items.Add(newListItem )

What I can't figure out is how to programatically set which of the List Items created is the one to be pre-selected in the rendered DropDownList, ie, how to create what I'd write in HTML as:

[Code]...

View 3 Replies

Append Name Of Each Checked List Box Item Selected To End Of Current Directory

Aug 11, 2009

[code] I am trying to append the name of each checked list box item selected to the end of the current directory but i am obviously doing something wrong.

View 3 Replies

Mouse Cursor Is Hiding Until Item Selected From Dropdown List

Jun 8, 2012

VB.NET Winforms Application... When a user starts typing in the search box of the application it automatically populates the name list dropdown box with the valid results and sets the droppeddown value to true... Everything is working fine except the fact that the user is forced to select a value from the name list or press the esc key because without doing so the mouse cursor just disappears and you have to move the mouse all the way outside the application for it to come back and it will only do so while outside the applicaiton.. Below is the code that I am using for this and it should be noted that I am using the droppeddown value else where in the application and none of those instances have an issue its only this one..

Private Sub u_lastName_Box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles u_lastName_Box.TextChanged
u_nameLook_Box.Items.Clear()

[Code]....

View 1 Replies

Retrieve Selected Value From The Dropdown List In Asp.net And Store It In Session Variable?

May 15, 2010

the dropdown list is showing data from database, but how to retrieve the selected value and store it in a session variable??

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved