ComboBox Selected Index For Data Entry
Aug 21, 2010
I am using vb 2008, DataBound Controls and typed dataset. My form is having Group Box (initially hidden) and some text box, combobox controls for Data Entry, and the code is
bsSales.AddNew()
txtCreditDays.Text = 20
dtDueDate.Value = dtSalesDate.Value.AddDays(txtCreditDays.Text)
cboGodown.SelectedIndex = 0 '
Default
gBox.Visible = True
dtSalesDate.Focus()
I have set the combo box to select the 1st record in the list however, when the next Statement that is "gBox.Visible=True" is executed, the Combo Box is again set to -1 position. Why is it?
View 2 Replies
ADVERTISEMENT
Nov 21, 2011
In my VB.net solution I have a form in which I have to choose a beginstation and an endstation. I have to select both from comboboxes. Now what I want is that when I choose a beginstation, the chosen station will be gone in the combobox of the endstation so that I can't pick the same endstation as the beginstation.Is there a way to do this? I've tried a lot with SQL and LINQ queries but it didn't work out :(
View 1 Replies
May 16, 2010
im having a problem regard combobox selected index.the combobox wont change its index when i type a text that is the same with one of the items and pressing tab. when i check its selected index its -1. ill give an example to make it simple..combobox items = AB, AC, AD i entered "AB" by simply typing it not by selecting in the dropdown.its index is -1, how can i make the index the same with the items in the drop down?
View 2 Replies
May 19, 2012
I need to develop a function called SetComboBox that accepts the category(ies) in the ComboBox as a string and returns an integer indicating the index position of the category in the ComboBox. The function is supposed to set the category in the ComboBox Selected Index property to match the string category stored in a database for an inventory item.
View 1 Replies
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
Oct 13, 2008
I can't seem to set the selected index or selected value of a DataGridView combobox when loading data from a database. My DGV has two combobox columns which are bound to datatables. The DGV itself is not bound initially. After adding a row, I select a value from each combobox which then populates the rest of the cells in the row. I'm using the EditingControlShowing event to add an eventhandler to catch the SelectedIndexChange of the combo boxes. This all works as needed. My issue comes when populating the DGV with saved data, I need to add the rows and set the selected index and/or selected value of each combo box. I've searched through various forums and articles for the last week with no luck.
I'm using VS2008 sp1, .NET 3.5 sp1 and SQL 2005 sp2 Express.
View 8 Replies
Feb 15, 2012
I have 1 Table Called "Menu" there are some textboxes and a combobox. I want to fill data in the Textbox called "Menu_Rate" on Selection of combobox selected item & coressponding rate of the Menu shoud be displayed in the textbox.
This is my Code
con.ConnectionString = "Data Source=localhost;Integrated Security=true;Initial Catalog=Restaurant"
cmd.CommandText = "select Menu_Rate from Menu where Menu_Name='" & cbMenu.SelectedItem & "'"
[Code].....
View 10 Replies
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
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
Mar 24, 2012
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?So, selecting 'false' will change the color to RED and selecting 'true' changes the color to GREEN.
View 39 Replies
Mar 1, 2012
Let me try to describe my problems in the simplest way: I have combobox1 and combobox2. I hope to achieve two things: Combox1 is bound to list1 (a list of string). When a user selects an item in list1, list2 (a list of string) will be obtained from database and combobox is bound to list2.If user specifies text1 in combobox1 and text2 in combobox2, then these two values will be shown in the comboboxes regardless of the bound lists.
[Code]...
So the results of above code is that goal 1 is achieved, but goal 2 is never achieved. combobox1.selected index is always 0 and combobox2.selected index is always 0 too.
View 1 Replies
Feb 29, 2012
I have one datagrid with bound items and Radio button.
I want a index of the row which i selected by chacked the
the radio button.
i used Datagrid.selectedindex
but it gives -1 every time.
View 1 Replies
Oct 22, 2011
i'm trying to get index of selected rows in this why
For Each riga As Integer In lbFolder.SelectedRows
MsgBox(lbFolder.Rows(lbFolder.CurrentRow.Index).Cells(2).ToString)
Next
[code]....
View 3 Replies
Oct 14, 2010
I just want to display data in a DataGridView (from SQL - already made the connection) based on what is selected in a ComboBox (data that is also coming from SQL). The 2 are separete on the form. I am using VB 2010.
This doesn't work for me:
objCommand2.CommandText = "SELECT ProductID, Name, Color, Size, ListPrice FROM SalesLT.Product WHERE ProductCategoryID = " & cbCategory.SelectedValue
[code].....
View 3 Replies
Mar 20, 2011
In vb.net using Data Reader while selecting an value in combobox should display an selected value record from the database into textbox.
View 4 Replies
Jan 15, 2012
I used a class MyList and with the Help of this MyList the combo box named cboCity was filled with City Code(like 1001,1002,etc..) as Value member and City Name (like Canada,California etc...) as display member.
Public Class MyList
Private _dispName As String
Private _valMember As Integer
Public Sub New()
[code].....
The value members 1001,1002,1003,1004 get inserted as per cbocity(combo box)display name selection , into the database and during the retrieval of the record the value member is obtained and based on that for eg:when i get 1001 the selected item should be Canada.I tried many ways while fetching the record and set the selected item but all fails .
View 1 Replies
Jan 25, 2010
when the user clicks on the add button another form launches, which enables the user to add student info such as name, address, course, start date and end date, this information is then written to class when the ok button on that form is clicked, and then displays the data on the initial form in data grid. the user can add multiple entries and they are all displayed on the intial form and a the data grid is populatedwhen any of the rows in the displayed grid is selected, and the update button is clicked then the same form launches as the previous one and but this time its in the update mode and pre populates the form with the inital values.
View 3 Replies
Mar 4, 2012
With my application I want to check what list box entry is selected in another app (different process).
View 1 Replies
Jul 15, 2011
I want to show selected entry of DGV on Separate form in VB .Net.When double click on one row of DGV then this row must be open in new form. How can I do it?
View 1 Replies
Feb 12, 2011
I'm not sure how to do it, I keep on getting the wrong output.My required solution is to click a name from the combo box and display bits of information.How would I loop it so if one entry is smaller than the previous, it doesn't affect it?
Dim filename As String = "subject.txt" 'Declare where the text file is'
Dim objRead As New System.IO.StreamReader(filename) 'Make objRead read the text file'
Dim array() As String = System.IO.File.ReadAllLines(filename) 'Make array a string'
[code]....
Now I know this is definitely wrong, but this is only part of the program.
View 2 Replies
May 19, 2011
Well I'm not sure how to do it, I keep on getting the wrong output.My required solution is to click a name from the combo box and display bits of information.How would I loop it so if one entry is smaller than the previous, it doesn't affect it?
Dim filename As String = "subject.txt" 'Declare where the text file is'
Dim objRead As New System.IO.StreamReader(filename) 'Make objRead read the text file'
Dim array() As String = System.IO.File.ReadAllLines(filename) 'Make array a string'
[code]....
View 2 Replies
Jun 5, 2011
If there was any easy were to make sure that an entry havent been used twice in a selection of ComboBoxes. Heres the start for what id have to do if there isnt.
Private Sub ComboBox9_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox9.SelectedIndexChanged
If ComboBox9.Text = ComboBox1.Text Or ComboBox2.Text Or ComboBox3.Text Or ComboBox4.Text Or
[CODE]..............................
View 1 Replies
Oct 3, 2011
I have a databound ComboBox on my form. Is there any way that I can make the first field blank.
View 1 Replies
Jan 31, 2012
I want to know How to get The last selected Index in the multi select of ListView.For example, when i select Item from index 1 to 10, so I get index 10 as the last selected index.But if i select Item from 10 to 1, so I get index 1 as the last selected index.
View 5 Replies
May 3, 2011
how to get the selected index from a listview i know you can do the "ListView.SelectedIndices.Item(0)" but then you still need to know the index of the selected item.
View 14 Replies
Dec 9, 2010
'Get the selected index of the list box 'use that selectedindex for the row of the array and get both the quantity and price into local variables in VB
[Code]...
View 6 Replies
Oct 19, 2011
Can any one tell me how can i get the current selected indel in the ListView.
I need to execute a code every time the selection changes in ListView.
I have listView with only one column. All the list will be in column 0.
I used the below code in Listview1_Click event and able to get the selected index value,but when i used the same code in the Listview1_SelectedIndexChanged and Listview1_ItemSelectionChanged its giving below below error Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
[Code]...
View 2 Replies
Dec 6, 2011
I think I'm having a brain fart on this but I can't seem to figure out why this is not working.
Public Class Radio_Main
Dim RadioDial As String = 1
Dim Go As String = "http://"
Private Sub pb_Tuner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pb_Tuner.Click
'My.Computer.Audio.Stop()
[Code]...
View 2 Replies
Jul 22, 2009
I drag Tabcontrol.& add two tab pages. I have contextmenu Strip, dat i bound to tabcontrol.I select the ContextMenuStrip & set it to ContextMenuStrip1
Now i right click on tab headers.Suppose i right click on tabpage1,contextmenu is displayed.I want that when i right click on tabpage..I want to get the index of that tab..Even if dat tab page is selected.[code...]
View 2 Replies
Jul 24, 2009
I drag Tabcontrol.& add two tab pages.I have contextmenu Strip, dat i bound to tabcontrol.I select the ContextMenuStrip & set it to ContextMenuStrip1Now i right click on tab headers.Suppose i right click on tabpage1,contextmenu is displayed.I want that when i right click on tabpage..I want to get the index of that tab..Even if dat tab page is selected.Ex-Mozilla.
Private Sub TabControl1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl1.MouseClick
Try
[code]....
Above event gives me the index,when i select the tab.
View 2 Replies