Making The First Combo Box Item Always The Selected Item
Hi.I have a combo box with a Dropdown list Style and which is invoked several times in different parts of my form. How can I make the first item in this combo box the selected item or the default item everytime I select it? Currently, what's happening is that the last item that I selected becomes the selected item the next time the combo box is invoked. Thanks for any suggestions in advance!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Which Item Selected In Combo Box
hello, how do I determine which item was elected in a combo box. I'm trying to use that info to make a selection in another combo box. Ex. If the user selects REG in the first combo box then 38 is shown in the next box. Here is my code so far. Do I need to create a variable and also use the index number?
Private Sub cboCTypeHrs_GotFocus()
If cboCTypeHrs.ListIndex = 0 Then
cboComRate.Text = 38.4
ElseIf cboCTypeHrs.ListIndex = 1 Then
cboComRate.Text = 57.6
Else: MsgBox ("Which rate should be used for hourly rate?")
End If
End Sub
As you can see, the first time I tab to it(cboCTypeHrs) I get the message box, if I choose Reg and tab to it again the 38.4 shows up in the other box, but I can never get OT to show 57.6 in the second box.
thanks, jim g
Using The Selected Item From A Combo Box
Hello! I am new to programming and vb6. I am trying to develop an application that will allow the user to select from a combo box a particular month to provide a list of birthdays for that month regardless of the year. Upon selecting the month, the application should query a sql database to return all dates for all years with the selected month. For usability, I've populated the combo boxes with text entries of the months of the year (ie, "January", "February", etc) using the List property of the combo box. The database stores the dates as YYYY-MM-DD. How do I convert the text string in the combo box to a date string so the database can find the available matches?
RESOLVED Combo Box - Selected Item
I have a combobox with a few values
When the user selects one of the values in the combobox (aka changes the value in the combobox) ... i would like the value in the combo box to display in a message box on the screen.
I would have thought that it would have been in the combo_change() sub... but its not kicking off.
VB Code:
private sub combo1_change()msgbox combo1.textend sub
Detecting The Item User Selected From A Combo Box
Hi guys
Any ideas?
I tried combo_Change, no responce
I tried combo_KeyUp, its more like for keyboards
I tried como_GotFocus, its doing the opposite that i want
I have addItem in to the combo box at form load.
now what i want is to be able to know what item the user had select from the combobox
so that i will be able to use that to filter my listview.
thanks a million
How To Fill A Listview Aording To Various Combo Item Selected
Good morning everybody. I'm newby in Vb...
I wish someone can help me in this matter :
On my form, I have 3 combo related to 3 tables and one listview. when I select one item in the first combo (let's call it Providers), on the listview I get all the products belonging to the provider selected. Up to here fine...
But with this Provider selected, I wish to, with the second combo related to the family products tbl, obtain in the same listview all the products related to that family item selected and related at the same time to the provider selected in the first combo. Ouf...
And so on with the third combo related with the table "categories of produts".
Thanks you in advance for your help and sorry for my poor english.
All the best to yu
Vivien
Making Last Item In Combo The Default
I'm loading a combo from a recordset. As such, I have no way of knowing, at any given time, how many items I'll have. I want to set a default of the last item in the combo (I want that to appear in the text portion of the combo box. So, I thought
VB Code:
Combo1.ListIndex = Combo1.ListCount
would do the trick nicely.
However, that line of code gives me an "Error 380 Invalid Property Value"
First, how can I make the last item the default?
Second, why doesn't what I did work?
Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,
I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)
How would this be done? Hope I make sense. Thanks in advance.
How To Search Listbox For Item If Item Not Found Add Item?
Hi, lol man I cant find nothing today when I search the forum.
This my latest problem, How do I search a listbox for an item lets say "Game Over" And if the item is found the program does nothing, but if the item is not found it will add "Game Over"
Thanks Again
Keeping Selected Item Selected (highlighted)
I have items selected in my listbox. My problem is that when i clcik on the file menu to delete them the highlight goes off them and the program thinks theres nothing to delete! How do i keep the highlight on the selected items and still click on other objects? Thanks
Keeping Selected Item Selected In A List Box
How could you keep the selected item selected until I refresh the list or till they unselect it?
Right now I have a global variable for the listIndex that is set on_mouse_down But I am not sure how to make the listIndex stay selected.
Selected Item
how do you change the color of the selected row of a listview. you know the normal color which is dark blue and its ugly. I want to use a light blue or tooltip color.
another question how do you find the total cpu usage of the system. or how do you find it for just 1 process ( its harder but i can add all the process cpus togethers )
Thanks!
Selected Item
Is there a way to select an item on the listview. Using the program of course not the persons mouse.
Such as...
Listview1.selectedItem = i
Because its not selecting it
Its actually replacing the first item and that cant happen in my prog
Selected Item
Hi All:
I am not sure how to accomplish this issue in VB. I have a listbox and it is populated with 5 items. I want to replace the text of the selected item from the listbox with the orgional text of the selected item+ "Del".
Something like this:
lstPerson.Selected(lstPerson.Listindex).Text =
lstPerson.Selected(lstPerson.Listindex).Text +"Del"
Please help!!
Thanks for all of you for helping me!!
Selected Item.
Hi,
I have got one question.
Dim selItemIndex As Integer
selItemIndex = Combo1.ListIndex
If selItemIndex = -1 Then
MsgBox "No item selected."
Else
Combo1.RemoveItem selItemIndex
End If
I am not sure What "-1" does in this program please?
Get Selected Item Name
Hi
For any windows form, desktop, can I get the selected item (Icon) name, like "doc1.doc", ....
Thanks in advance.
Keep Listview Selected Item Selected
I've been searching the site this morning and I've seen this question asked numerous times and the answer appears to be no. I thought I'd try again in case there is a fresh set of eyes out there.
I'm working on a preexisting production form and the person that designed it coded a series of combo boxes next to a series of listviews as user controls. When a combo box loses focus the selected item remains the default selected blue color. When the listview loses focus the selected item's color is a light gray.
I would like the listview selected item to remain blue like the combo boxes so the appearance is uniform.
The user community has lived with this for quite some time so I can't justify the time to rework the form. But if someone knows how to keep the selected item blue when the listview loses focus I'll plug it in though.
Listview Get Currently Selected Item
Is there a way to get the currently selecteditems text for a listview. I'm using vb 2005 and I don't see how to get a listview currently selecteditem. Someone please help me
Thanks for any help
Chris Ara
Listview Selected Item
How can i get the selected item of a listview in another form ???
I have tried with this code:
Code:
Public Function geselecteerdLid() As Integer
Dim iLidID As Integer
Dim oItem As ListViewItem
For Each oItem In lvwLeden.SelectedItems
iLidID = Convert.ToInt32(oItem.Text)
Return iLidID
Next
End Function
and in another form i refer to this with
Code:
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
Dim oForm As New frmLid
MessageBox.Show(oForm.geselecteerdLid)
End Sub
the result of this is always 0, i guess this is because i make an object of the form where my listview is (frmLid)
If Item In A List Is Not Selected
Hi All,
How can I do a test to see if there has been any items in a list selected. ie. if there has not been an item selected show a message box, else form2.show.
Thanks
Loftty
Listbox Selected Item
Hello again!
I was wondering if anyone knew how to make the selected item from a listbox appear in a text box.
For instance List1 as the list box and Text1 as the text.box? Is it just one of the properties because I have not be able to find it.
Thank you for all your help!
Selected Item Or Subitem
I have a multi-column listview (report view).
If the user clicks on a SUBITEM (not item) , is it possible to know which subitem is clicked ?
or
to identify the user just clicked on ITEM or SubItem ?
thanks
Combobox Need To Have Item Selected
I have a combo Box and for it to go to next form I want an Item in the combobox to be selected but if nothing is selected then display an error below is my current code but it dosent work
Private Sub cmdAdd_Click()
Product = txtpCode.Text
If cmbColour.Text = "" Then
lblError.Caption = "Select a Colour"
Else
Colour = cmbColour.Text
End If
frmBasket.Show
frmShop.Hide
End Sub
Always Have Last Item In Listbox Selected
How can I make it so the last item in a listbox be selected, even after new items are added. For instance, lets say I had four items in a listbox like this:
I'm one
I'm two
I'm three
I'm four
At this point I'd want "I'm four" to be selected and if I added another item like this:
I'm one
I'm two
I'm three
I'm four
I'm five
Then at this point I would want "I'm five" to be selected. Does anyone know of a way to do this ?
Thanks in advance for any help!
How To Get Listview Selected Item?
Code:
Private Sub Form_Load()
With lvwSpecies
' Add three columns to the list - one for each data type.
' Note that the data type is set in the column header's
' tag in each case
.ColumnHeaders.Add(, , strHeader(0)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(1)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(2)).Tag = "String"
' Set the column alignment - has no bearing on the sorts.
.ColumnHeaders(1).Alignment = lvwColumnLeft
.ColumnHeaders(2).Alignment = lvwColumnCenter
.ColumnHeaders(3).Alignment = lvwColumnCenter
.ColumnHeaders(2).Width = 3000
'Populate the list with data in Species files
Dim intCounter As Integer
With .ListItems
For intCounter = LBound(codeTypeArray) To UBound(codeTypeArray)
With .Add(, , codeTypeArray(intCounter).strCode)
.ListSubItems.Add , , codeTypeArray(intCounter).strCodeInfo
.ListSubItems.Add , , str(codeTypeArray(intCounter).intMaxNumber)
End With
Next
End With
End With
End Sub
Private Sub ok_Click()
Dim str As String
str = lvwSpecies.text
'what should go here if i want to get the text of select item? i just
'need the text of first colum.
End Sub
Is there a way to get the item text?
Thanks
Listview - Selected Item
Dear All,
I have an access DB connected to a Treeview and a listview.
Navigation is done by ADO unbound.
How do I connect the highlighted item in the listview with a particular database recordset?
Say for example:
I click on the Next_Record button I would like the Cursor (Highlighted blue area) to move to the next record displayed in the listview corresponding to the correct database record.
Prev_Record button will move the blue highlighted area one position up in the listview and so forth...
Any ideas?
TIA
DHTMLEdit Set/Get Selected Item
Hi
I found the DHTMLEdit control just a few days ago, and it is really a good solution for my problems. Now I don't need to write a whole texteditor with images support, like I already started.
However, I need to know a few things about, it. The best way would be a nice tutorial on how to use it, or a good documentation (MSDN isn't that pretty good). Or some example applications. :/
Here are my questions, maybe someone knows some answers:
-------------------------------------------------
1) How can I find out, the selected object? (images, i.e.)
I tried the solution from the MSDN, but I can't define the following variable:
Dim ctlRg As IHTMLControlRange
Visual Basic don't know what a "IHTMLControlRange" is o.o
-------------------------------------------------
2) How can I SET the current selected object? (images, i.e.)
-------------------------------------------------
3) How can I select the last inserted image, immediately, after I inserted it?
Thanks for every help =D
To Put The Value Selected Item Into Variable
hi guys, i have use listview to display information of employee's application, whut i want is when user click on the specific date on list view it will open the other form and the info abt the application displayed is application on the date user click on. But it cannot display because there is an error. Below is my code
Code:
Option Explicit
'Declaration to change form
Const LWA_COLORKEY = &H1
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Const BM_SETSTATE = &HF3
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Sub Form_Load()
'Window according to picture
Dim lngSTL As Long
Dim lngCLR As Long
lngCLR = RGB(0, 255, 0) 'this color is the color that will be transparent
'Set the window style to 'Layered'
lngSTL = WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, lngSTL
SetLayeredWindowAttributes Me.hWnd, lngCLR, 0, LWA_COLORKEY
sqlStr = "select Emp.FullName, LApp.EmpNo, LApp.Date_app, LApp.LCode, MLiv.LName"
sqlStr = sqlStr & " from tblMEmployee Emp, tblLeaveApp LApp, tblMLeave MLiv"
sqlStr = sqlStr & " Where Emp.EmpNo = LApp.EmpNo"
sqlStr = sqlStr & " and LApp.LCode = MLiv.LCode"
sqlStr = sqlStr & " and LApp.RecStatus = 'Waiting'"
sqlStr = sqlStr & " and LApp.RecEmpNo = '" & ndEmpNo & "'"
sqlStr = sqlStr & " and LApp.ApprStatus IS NULL "
sqlStr = sqlStr & " Order By LApp.Date_app, Emp.FullName"
myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
Dim itmX As ListItem ' Create a variable to add ListItem objects.
Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.
' Add ColumnHeaders.
Set clmX = ListView1.ColumnHeaders.Add(, , "Date Apply", ListView1.Width / 6)
Set clmX = ListView1.ColumnHeaders.Add(, , "Name ", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Leave Type", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders.Add(, , "Leave Code", ListView1.Width / 25)
Set clmX = ListView1.ColumnHeaders.Add(, , "EmpNo", ListView1.Width / 25)
Set clmX = ListView1.ColumnHeaders.Add(, , "Date_app", ListView1.Width / 25)
ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
ListView1.View = lvwReport ' Set View property to Report.
Dim ndDate, ndFDate As String
Do While Not myRecSet.EOF '''
ndDate = myRecSet("Date_app")
ndFDate = Mid(ndDate, 7, 2) & "-" & Mid(ndDate, 5, 2) & "-" & Mid(ndDate, 1, 4)
' Add a main item
Set itmX = ListView1.ListItems.Add(, , ndFDate)'-->i want to get this value
' Add two subitems for that item
itmX.SubItems(1) = myRecSet("Fullname")
itmX.SubItems(2) = myRecSet("LName")
itmX.SubItems(3) = myRecSet("LCode")
itmX.SubItems(4) = myRecSet("EmpNo")
itmX.SubItems(5) = ndDate
myRecSet.MoveNext
Loop
myRecSet.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form6.Show
End Sub
Private Sub ListView1_DblClick()
ndLeaApprEmpNo = Trim(ListView1.SelectedItem.SubItems(4))
ndLeaApprLCode = Trim(ListView1.SelectedItem.SubItems(1))
ndLeaApprDt = Trim(ListView1.SelectedItem.SubItems(5))
'MsgBox ndLeaApprEmpNo & ", " & ndLeaApprLCode & ", " & ndLeaApprDt
ndLeaApplydt = Trim(ListView1.SelectedItem.Items)'-->this is the code where i try to get main item value but it said method or data member not found
Unload Me
formSignature.Show
End Sub
can anyone help me fix my code
Selected Item Of Combobox
In VB 2005 it is cboServer.SelectedItem, but how can I find he selected item of an combobox in vb 6.0 ?
Retrieve The Selected Item Name
Can anyone please tell me how to retrieve the NAME of an item selected in a LISTBOX?
For e.g. a user has entered 3 names (x, y and z) into the list box . How can I retrieve the selected name?
Thanks alot
ListView Selected Item!
In a WebBrowser project, a ListView acts as the history window. This ListView comes up when the History button is clicked. Each URL is represented in the ListView by the title of that URL (like IE). For e.g. if the user has visited http://www.yahoo.com, it's title i.e. Yahoo! will get listed in the history ListView. Users have been given the option to delete any URL/s from the ListView.
Assume that currently I am viewing http://www.yahoo.com. If the history ListView is now invoked, Yahoo! will be highlighted in the ListView (since I am presently viewing http://www.yahoo.com). Suppose I delete any other URL in the ListView. Under such circumstances, the very first URL gets highlighted in the ListView but I want Yahoo! to remain highlighted in the ListView after that URL is deleted from. How do I accomplish this?
ListView Selected Item!
In a WebBrowser project, I am using a ListView which acts as a "history" window (like how IE opens a side-window when the history icon is clicked on the toolbar). As is evident, the ListView lists all the URLs that a user has visited.
When I click an item in the ListView, I want that after the appropriate web page gets downloaded completely, the item selected should remain highlighted which is why I have set the ListView's HideSelection property to False.
Assume that I click the 5th item in the ListView. When I do so, the selected URL gets highlighted & the browser navigates to the corresponding URL but after the web page gets downloaded completely, the first item in the ListView gets highlighted but I want the item that was clicked by the user should remain highlighted after the web page loads completely. In other words, I want the 5th item in the ListView to remain highlighted after the web page loads (since I had clicked the 5th item in the ListView). How do I implement this?
Whenever the ListView loads, the first item in the ListView is seen highlighted (as HideSelection is set to False) but I don't want the 1st item (or for that matter, any of the items) in the ListView to get highlighted whenever the ListView loads i.e. none of the items should be highlighted whenever the ListView loads. How do I do this?
Listview Selected Item
ok my app has a listview which has a check box in it. I have setup so that when someone clicks on an item, the selected item becomes checked. how do i set for when the item becomes checked, the item becomes selected???
hope i explained that correctly...
please help me code
Listview Selected Item
I have a listview on a form...
The item which is selected should be selected even if the form looses focus or unloads.
Next time when form gets focus that previously seleted item should be selected...........
First Selected Item In Treeview
I have a little program tha thas a treeview in it. by default when the program opens up nothing is selected. but if you click any where in the box it selects the very fisrt item (the parent)
how do I set it so you don't have to click on the box or anywhere to get the first item to be selected?
If Item In A List Is Not Selected
Hi All,
How can I do a test to see if there has been any items in a list selected. ie. if there has not been an item selected show a message box, else form2.show.
Thanks
Loftty
ListView Selected Item
Have any easy question about ListViews. When my form opens up the first item in my listview is selected. How would I keep this from happening? Do I need to loop through all items in the list view and set the selected property to false or is there an eaiser way. I would like to keep my load time down on my form.
Thanks ahead of time.
Listview Selected Item
Hi,
I have a listview populated with a few dozen records from my database.
The listview has 10 column's. I try to make a change to for example the 3th record the 5th column. Althougt I select the 5th column always the first column of the 3th record is updatable.
How can I accomplish that I can select any cell of the listview to make an adjustment with I can send to my database.
I'm in great need for a solution, but can't (after a whole try and search) find it, plaese has someone a helping hand
With regard, thanx in advance
Charles
Which Item Selected In Imagecombo ? **
How do I tell which image the user has selected in an imagecombo control in which there are just images (no text)
VB Code:
Option Explicit Private Sub Form_Load() Dim sColourArray(9) As String, i As Integer sColourArray(0) = vbBlue sColourArray(1) = vbRed sColourArray(2) = vbGreen sColourArray(3) = vbYellow sColourArray(4) = vbBlack sColourArray(5) = vbWhite sColourArray(6) = vbCyan sColourArray(7) = vbMagenta sColourArray(8) = vbButtonFace sColourArray(8) = vbHighlight sColourArray(9) = vbInfoBackground For i = 0 To 9 picPicBox.BackColor = sColourArray(i) ilsImageList.ListImages.Add , , picPicBox.Image icmbColourCombo.ComboItems.Add , , , i + 1 Next End Sub Private Sub icmbColourCombo_Click() 'What goes here ? End Sub
How Do You Get A Selected Listbox Item's Name?
i have a question. how do you get a selected listbox item's name? what i mean is if i selected "yo" from my listbox i want text 1 to be yo when i click a command button or something. plz help. thanks in advance
|