KOCUBA
asked on
Combo box and highlighting
I have a number of combo boxes on a form. When I display this form all of the data, in each of the boxes, in the form are highlighted. How can I get this not to happen? it is really starting to irratate me.
Dave
Dave
You can set the listindex property to -1 which will deselect any selection.
If All of the data in a combobox are highlighted i would check the forecolor and backcolor properties of the control.
ASKER
Ok sorry it is still a little early. I guess what I should have said is I load the combo box with additem then I set the text property to a value from a database that would be a selection in the list of loaded values. The text that I set it equal to is what is highlighted.
smegghead, I tried your suggestion and it did not change anything.
viqdis, I hope my above clarification helps
Sorry Again
Dave
smegghead, I tried your suggestion and it did not change anything.
viqdis, I hope my above clarification helps
Sorry Again
Dave
set the selstart and sellength properties of the combobox to 0..
is this a bound combobox ???
Smegg
is this a bound combobox ???
Smegg
Try this:
Put a picturebox to the form.
Set those picturebox properties:
Appearance = 0 - Flat
Borderstyle = 0 -None
Backcolor = Backcolor of the form
In the Clik event of the
combobox put this line:
Picture1.SetFocus
Int the Lostffocus event of the combo:
Combo2.BackColor = vbWhite
Combo2.ForeColor = vbBlack
Put a picturebox to the form.
Set those picturebox properties:
Appearance = 0 - Flat
Borderstyle = 0 -None
Backcolor = Backcolor of the form
In the Clik event of the
combobox put this line:
Picture1.SetFocus
Int the Lostffocus event of the combo:
Combo2.BackColor = vbWhite
Combo2.ForeColor = vbBlack
ASKER
smegghead, I've tried setting those prpoerties to zero and that did not work. Also this is not a bound cbombobox.
viqdis
That did not work either.
viqdis
That did not work either.
What is the style of the combobox ???
If I put of combobox on my screen, it only highlights the text when the control has focus.
not sure what's happening on yours..
If I put of combobox on my screen, it only highlights the text when the control has focus.
not sure what's happening on yours..
ASKER
smegghead,
The style is 0 - Dropdown Combo.
Usually that is what happens with mine. But when this form loads I have 6 different combo boxes all of which are highlighted.
The style is 0 - Dropdown Combo.
Usually that is what happens with mine. But when this form loads I have 6 different combo boxes all of which are highlighted.
hmmm, strange !!!
can you post the .frm contents here .. or is it too complex ??
can you post the .frm contents here .. or is it too complex ??
ASKER
Was just thinking about doing that here is the sub that loads all the fields on the form. The comboboxes are right near the beginning.
Thanks for all the help.
Public Sub Load_Fields()
On Error GoTo Load_Fields_Err
Dim intI As Integer
txtDistNo.Text = g_config.lngDistNo
intI = 0
While arrDistType(intI, 0) <> g_config.strDistType
intI = intI + 1
Wend
txtDistType.Text = arrDistType(intI, 1)
txtName.Text = g_config.strDistName
txtAddress(0).Text = g_config.strAddr1
txtAddress(1).Text = g_config.strAddr2
txtCity.Text = g_config.strCity
txtState.Text = g_config.strState
txtZip.Text = g_config.strZip
If g_config.strCountry <> "" Then
intI = 0
While arrCountryCodes(intI, 0) <> g_config.strCountry
intI = intI + 1
Wend
cboCountry.Text = arrCountryCodes(intI, 1)
End If
intI = 0
While arrCountryCodes(intI, 0) <> ""
cboCountry.AddItem arrCountryCodes(intI, 1)
intI = intI + 1
Wend
intI = 0
While MiscCode(intI, 0) <> ""
cboMisc1.AddItem MiscCode(intI, 1)
cboMisc2.AddItem MiscCode(intI, 1)
cboMisc3.AddItem MiscCode(intI, 1)
cboMisc4.AddItem MiscCode(intI, 1)
intI = intI + 1
Wend
If g_config.strMiscType1 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType1
intI = intI + 1
Wend
cboMisc1.Text = MiscCode(intI, 1)
End If
txtMisc1.Text = g_config.strMiscValue1
intI = 0
If g_config.strMiscType2 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType2
intI = intI + 1
Wend
cboMisc2.Text = MiscCode(intI, 1)
End If
txtMisc2.Text = g_config.strMiscValue2
If Not IsNull(g_config.strMiscTyp e3) Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType3
intI = intI + 1
Wend
cboMisc3.Text = MiscCode(intI, 1)
End If
txtMisc3.Text = g_config.strMiscValue3
If g_config.strMiscType4 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType4
intI = intI + 1
Wend
cboMisc4.Text = MiscCode(intI, 1)
End If
txtMisc4.Text = g_config.strMiscValue4
intI = 0
While arrLanguage(intI, 0) <> ""
cboLanguage.AddItem arrLanguage(intI, 1)
intI = intI + 1
Wend
intI = 0
While arrLanguage(intI, 0) <> g_config.strLangCode
intI = intI + 1
Wend
cboLanguage.Text = arrLanguage(intI, 1)
txtMatcoWeekNo.Text = g_config.lngMatcoWeekNo
txtWeeksInBusiness.Text = g_config.lngWeeksInBusines s
intI = 0
While arrDayofWeek(intI, 0) <> g_config.lngShipDay
intI = intI + 1
Wend
txtShipDay.Text = arrDayofWeek(intI, 1)
intI = 0
While arrJurisdictions(intI, 0) <> ""
cboJurisdiction.AddItem arrJurisdictions(intI, 1)
intI = intI + 1
Wend
intI = 0
While arrJurisdictions(intI, 0) <> g_config.lngJurisdictionNo
intI = intI + 1
Wend
cboJurisdiction.Text = arrJurisdictions(intI, 1)
txtStatementPercent.Text = g_config.dblStatementPerce nt
txtMaxTPLongTerm.Text = g_config.dblMaxTPLongTerm
txtCustCreditLimit.Text = g_config.dblCustCreditLimi t
txtNoDaysLockPSAQuote.Text = g_config.lngNoDaysLockPSAQ uote
txtDelNotesKeepDays.Text = g_config.lngDelNotesKeepDa ys
txtPkgLstRetentionDays.Tex t = g_config.lngPkgLstRetentio nDays
txtTPTurns.Text = g_config.dblTPTurns
txtMinTPPayment.Text = g_config.dblMinTPPayment
txtNSFChargeAmt.Text = g_config.dblNSFChargeAmt
txtStmtFeeDesc.Text = g_config.strStmtFeeDesc
chkPrintPSARemit.Value = g_config.bolDayPrintPSARem it
txtAppRetentionDays.Text = g_config.lngAppRetentionDa ys
sschkElecFundsXfer.Value = g_config.bolElecFundsXfer
sschkHistOnRouteList.Value = g_config.bolHistOnRouteLis t
sschkDispCredLimWarn.Value = g_config.bolDispCredLimWar n
sschkAdjustWkPay.Value = g_config.bolAdjustWkPay
sschkXmitPSAPmtData.Value = g_config.bolXmitPSAPmtData
sschkPrintProspects.Value = g_config.bolPrintProspects
sschkBalOnlyOnRouteList.Va lue = g_config.bolBalOnlyOnRoute List
Select Case Trim(g_config.strReportCus tomersType )
Case "A"
optReportCustomers(1).Valu e = True
Case "S"
optReportCustomers(0).Valu e = True
Case Else
optReportCustomers(2).Valu e = True
End Select
txtMinSkipBalance.Text = g_config.dblMinSkipBalance
sschkTermsAndConditions.Va lue = g_config.bolTermsAndCondit ions
sschkSigOnReceipt.Value = g_config.bolSigOnReceipt
sschkFormFeedAfterReceipt. Value = g_config.bolFormFeedAfterR eceipt
sschkPhNoOnReceipt.Value = g_config.bolPhNoOnReceipt
sschkPrintAddrOnReceipt.Va lue = g_config.bolPrintAddrOnRec eipt
txtNoReceiptsDown.Text = g_config.lngNoReceiptDown
txtNoReceiptsAcross.Text = g_config.lngNoReceiptsAcro ss
sschkOnHandWarn.Value = g_config.bolOnHandWarn
sschkFullInvtMaint.Value = g_config.bolFullInvtMaint
sschkPrintOnlyInvtItems.Va lue = g_config.bolPrintOnlyInvIt ems
sschkBldReOptItemsOrder.Va lue = g_config.bolBldReOpItemsOr der
sschkBldPromoOrder.Value = g_config.bolBldPromoOrder
txtRemSentOrdersDays.Text = g_config.lngRemSentOrderDa ys
txtStdTradeInMarginPercent age.Text = g_config.dblStdTradeInMarg Percentage
txtNoDaysRemRegOrders.Text = g_config.lngNoDaysRemRegOr ders
txtNoDaysRemSpecOrders.Tex t = g_config.lngNoDaysRemSpeci alOrders
Select Case g_config.strValueInvType
Case ""
optValueInvtType(0).Value = True
Case "LAST"
optValueInvtType(1).Value = True
Case Else
optValueInvtType(2).Value = True
End Select
txtMarketingMessage.Text = g_config.strMarketingMessa ges
sschkSendWklyToMatco.Value = g_config.bolSendWklyToMatc o
sschkAcceptMsgWhenSending. Value = g_config.bolAcceptMsgWhenS ending
sschkToolTips.Value = g_config.bolToolTips
txtSysInfoCollectionDate.T ext = g_config.dtmSysInfoCollect ion
txtSysInfoIntervalDays.Tex t = g_config.lngSysInfoInterva lDays
txtNextBuildNo.Text = g_config.lngOrderBuildNo
txtLastInvMiscSlsPrint.Tex t = g_config.lngLastInvMiscSls Print
txtLastInvTradeInPrint.Tex t = g_config.lngLastInvTradeIn Print
txtLastInvAdjPrint.Text = g_config.lngLastInvAdjPrin t
txtLastPSARemBatch.Text = g_config.strLastPSARemBatc h
txtNextPSABatchNo.Text = g_config.lngNextPSABatchNo
txtNextCustNo.Text = g_config.lngNextCustNo
txtNextPkgListNo.Text = g_config.lngNextPkgListNo
txtBusinessUnit.Text = g_config.strBusinessUnit
txtMonthCloseDate.Text = g_config.dtmMonthClose
txtWeekCloseDate.Text = g_config.dtmWeekClose
txtYearCloseDate.Text = g_config.dtmYearClose
lblVersionNo.Caption = lblVersionNo.Caption & g_config.strVersionNo
cboMisc1.SelLength = 0
cboMisc1.SelStart = 0
m_bolchanged = False
Exit Sub
Load_Fields_Err:
CentralErrorHandler "frmSysConfig.Load_Fields"
Resume Next
End Sub
Thanks for all the help.
Public Sub Load_Fields()
On Error GoTo Load_Fields_Err
Dim intI As Integer
txtDistNo.Text = g_config.lngDistNo
intI = 0
While arrDistType(intI, 0) <> g_config.strDistType
intI = intI + 1
Wend
txtDistType.Text = arrDistType(intI, 1)
txtName.Text = g_config.strDistName
txtAddress(0).Text = g_config.strAddr1
txtAddress(1).Text = g_config.strAddr2
txtCity.Text = g_config.strCity
txtState.Text = g_config.strState
txtZip.Text = g_config.strZip
If g_config.strCountry <> "" Then
intI = 0
While arrCountryCodes(intI, 0) <> g_config.strCountry
intI = intI + 1
Wend
cboCountry.Text = arrCountryCodes(intI, 1)
End If
intI = 0
While arrCountryCodes(intI, 0) <> ""
cboCountry.AddItem arrCountryCodes(intI, 1)
intI = intI + 1
Wend
intI = 0
While MiscCode(intI, 0) <> ""
cboMisc1.AddItem MiscCode(intI, 1)
cboMisc2.AddItem MiscCode(intI, 1)
cboMisc3.AddItem MiscCode(intI, 1)
cboMisc4.AddItem MiscCode(intI, 1)
intI = intI + 1
Wend
If g_config.strMiscType1 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType1
intI = intI + 1
Wend
cboMisc1.Text = MiscCode(intI, 1)
End If
txtMisc1.Text = g_config.strMiscValue1
intI = 0
If g_config.strMiscType2 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType2
intI = intI + 1
Wend
cboMisc2.Text = MiscCode(intI, 1)
End If
txtMisc2.Text = g_config.strMiscValue2
If Not IsNull(g_config.strMiscTyp
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType3
intI = intI + 1
Wend
cboMisc3.Text = MiscCode(intI, 1)
End If
txtMisc3.Text = g_config.strMiscValue3
If g_config.strMiscType4 <> "" Then
intI = 0
While MiscCode(intI, 0) <> g_config.strMiscType4
intI = intI + 1
Wend
cboMisc4.Text = MiscCode(intI, 1)
End If
txtMisc4.Text = g_config.strMiscValue4
intI = 0
While arrLanguage(intI, 0) <> ""
cboLanguage.AddItem arrLanguage(intI, 1)
intI = intI + 1
Wend
intI = 0
While arrLanguage(intI, 0) <> g_config.strLangCode
intI = intI + 1
Wend
cboLanguage.Text = arrLanguage(intI, 1)
txtMatcoWeekNo.Text = g_config.lngMatcoWeekNo
txtWeeksInBusiness.Text = g_config.lngWeeksInBusines
intI = 0
While arrDayofWeek(intI, 0) <> g_config.lngShipDay
intI = intI + 1
Wend
txtShipDay.Text = arrDayofWeek(intI, 1)
intI = 0
While arrJurisdictions(intI, 0) <> ""
cboJurisdiction.AddItem arrJurisdictions(intI, 1)
intI = intI + 1
Wend
intI = 0
While arrJurisdictions(intI, 0) <> g_config.lngJurisdictionNo
intI = intI + 1
Wend
cboJurisdiction.Text = arrJurisdictions(intI, 1)
txtStatementPercent.Text = g_config.dblStatementPerce
txtMaxTPLongTerm.Text = g_config.dblMaxTPLongTerm
txtCustCreditLimit.Text = g_config.dblCustCreditLimi
txtNoDaysLockPSAQuote.Text
txtDelNotesKeepDays.Text = g_config.lngDelNotesKeepDa
txtPkgLstRetentionDays.Tex
txtTPTurns.Text = g_config.dblTPTurns
txtMinTPPayment.Text = g_config.dblMinTPPayment
txtNSFChargeAmt.Text = g_config.dblNSFChargeAmt
txtStmtFeeDesc.Text = g_config.strStmtFeeDesc
chkPrintPSARemit.Value = g_config.bolDayPrintPSARem
txtAppRetentionDays.Text = g_config.lngAppRetentionDa
sschkElecFundsXfer.Value = g_config.bolElecFundsXfer
sschkHistOnRouteList.Value
sschkDispCredLimWarn.Value
sschkAdjustWkPay.Value = g_config.bolAdjustWkPay
sschkXmitPSAPmtData.Value = g_config.bolXmitPSAPmtData
sschkPrintProspects.Value = g_config.bolPrintProspects
sschkBalOnlyOnRouteList.Va
Select Case Trim(g_config.strReportCus
Case "A"
optReportCustomers(1).Valu
Case "S"
optReportCustomers(0).Valu
Case Else
optReportCustomers(2).Valu
End Select
txtMinSkipBalance.Text = g_config.dblMinSkipBalance
sschkTermsAndConditions.Va
sschkSigOnReceipt.Value = g_config.bolSigOnReceipt
sschkFormFeedAfterReceipt.
sschkPhNoOnReceipt.Value = g_config.bolPhNoOnReceipt
sschkPrintAddrOnReceipt.Va
txtNoReceiptsDown.Text = g_config.lngNoReceiptDown
txtNoReceiptsAcross.Text = g_config.lngNoReceiptsAcro
sschkOnHandWarn.Value = g_config.bolOnHandWarn
sschkFullInvtMaint.Value = g_config.bolFullInvtMaint
sschkPrintOnlyInvtItems.Va
sschkBldReOptItemsOrder.Va
sschkBldPromoOrder.Value = g_config.bolBldPromoOrder
txtRemSentOrdersDays.Text = g_config.lngRemSentOrderDa
txtStdTradeInMarginPercent
txtNoDaysRemRegOrders.Text
txtNoDaysRemSpecOrders.Tex
Select Case g_config.strValueInvType
Case ""
optValueInvtType(0).Value = True
Case "LAST"
optValueInvtType(1).Value = True
Case Else
optValueInvtType(2).Value = True
End Select
txtMarketingMessage.Text = g_config.strMarketingMessa
sschkSendWklyToMatco.Value
sschkAcceptMsgWhenSending.
sschkToolTips.Value = g_config.bolToolTips
txtSysInfoCollectionDate.T
txtSysInfoIntervalDays.Tex
txtNextBuildNo.Text = g_config.lngOrderBuildNo
txtLastInvMiscSlsPrint.Tex
txtLastInvTradeInPrint.Tex
txtLastInvAdjPrint.Text = g_config.lngLastInvAdjPrin
txtLastPSARemBatch.Text = g_config.strLastPSARemBatc
txtNextPSABatchNo.Text = g_config.lngNextPSABatchNo
txtNextCustNo.Text = g_config.lngNextCustNo
txtNextPkgListNo.Text = g_config.lngNextPkgListNo
txtBusinessUnit.Text = g_config.strBusinessUnit
txtMonthCloseDate.Text = g_config.dtmMonthClose
txtWeekCloseDate.Text = g_config.dtmWeekClose
txtYearCloseDate.Text = g_config.dtmYearClose
lblVersionNo.Caption = lblVersionNo.Caption & g_config.strVersionNo
cboMisc1.SelLength = 0
cboMisc1.SelStart = 0
m_bolchanged = False
Exit Sub
Load_Fields_Err:
CentralErrorHandler "frmSysConfig.Load_Fields"
Resume Next
End Sub
what happens if you create a new form with just cboMisc and populate them in the same way... can you provide a trimmed down version that I can just paste into a .frm file and load... to see if it happens on mine aswell.
KOCUBA:
You need to clearly explain exactly what you mean by "highlighting".
You could mean the text in the combo box is highlighted (i.e. text of the current value is selected). However, you cannot mean this, because when the combo box looses focus, the text is displayed normally.
You could mean the item in the dropdown list is highlighted to match the text in the combobox.
Those are two possible meanings you could be referring to when you say "highlighting"
Please explain what you mean. Otherwise, everyone will be making suggestions based upon what they *think* you mean, which may not be the same.
-Dennis Borg
You need to clearly explain exactly what you mean by "highlighting".
You could mean the text in the combo box is highlighted (i.e. text of the current value is selected). However, you cannot mean this, because when the combo box looses focus, the text is displayed normally.
You could mean the item in the dropdown list is highlighted to match the text in the combobox.
Those are two possible meanings you could be referring to when you say "highlighting"
Please explain what you mean. Otherwise, everyone will be making suggestions based upon what they *think* you mean, which may not be the same.
-Dennis Borg
ASKER
smegghead,
I started a new project with one combo box and the following code.
Combo1.AddItem " ", 0
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = 1
And I still get the text in the combo box highlighted.
Dennis,
Again sorry for any confusion. It is the text in the combo box that is highlighted. I thought I helped clear that up in my second posting. But maybe not. I hope this helps a little more.
The really confusing thing is that it is more tha none combo box that is this way. I could possibly see one but not six.
I dont know??
I started a new project with one combo box and the following code.
Combo1.AddItem " ", 0
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = 1
And I still get the text in the combo box highlighted.
Dennis,
Again sorry for any confusion. It is the text in the combo box that is highlighted. I thought I helped clear that up in my second posting. But maybe not. I hope this helps a little more.
The really confusing thing is that it is more tha none combo box that is this way. I could possibly see one but not six.
I dont know??
>It is the text in the combo box that is highlighted.
The reason I say this is not possible is because when the combo box looses the focus (i.e. you move the cursor to a different control, such as another combo box, a button, textbox, etc), the text in the combo box is no longer selected.
Given your original quote:
When I display this form all of the
data, in each of the boxes, in the
form are highlighted.
Given the sample code you are using to populate the list box of you combo box, your very first item has one space.
Why are you adding an item that has nothing but spaces?
If you are trying to make the combo box have NO INITIAL VALUE, then you need to set the ListIndex property to -1:
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = -1
-Dennis Borg
The reason I say this is not possible is because when the combo box looses the focus (i.e. you move the cursor to a different control, such as another combo box, a button, textbox, etc), the text in the combo box is no longer selected.
Given your original quote:
When I display this form all of the
data, in each of the boxes, in the
form are highlighted.
Given the sample code you are using to populate the list box of you combo box, your very first item has one space.
Why are you adding an item that has nothing but spaces?
If you are trying to make the combo box have NO INITIAL VALUE, then you need to set the ListIndex property to -1:
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = -1
-Dennis Borg
Also remember, the items in your combo box is zero-based.
In other words, the first item is ListIndex = 0.
The second item is ListIndex=1.
And so on. So, if you want the FIRST ITEM to be the default value of the combo box, then you would set the ListIndex property to Zero (0), not 1:
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = 0 '<---- Set to FIRST item in the list
-Dennis Borg
In other words, the first item is ListIndex = 0.
The second item is ListIndex=1.
And so on. So, if you want the FIRST ITEM to be the default value of the combo box, then you would set the ListIndex property to Zero (0), not 1:
Combo1.AddItem "Test1", 1
Combo1.AddItem "Test2", 2
Combo1.AddItem "Test3", 3
Combo1.ListIndex = 0 '<---- Set to FIRST item in the list
-Dennis Borg
ASKER
Dennis,
That is why this is driving me completely nuts. It is like all of those boxes are selected at the same time. ????
The addition of the space is so that if the user does not want any value in there it will blank it out in the database.
FYI... I took one of the combo boxes and did not load the items and it does not come back with the text selected. I put it back in and it goes back to what it was doing. ??
That is why this is driving me completely nuts. It is like all of those boxes are selected at the same time. ????
The addition of the space is so that if the user does not want any value in there it will blank it out in the database.
FYI... I took one of the combo boxes and did not load the items and it does not come back with the text selected. I put it back in and it goes back to what it was doing. ??
ASKER
Okay,
I shortened the problem down into another project file. And it is still doing the same thing. Here is the code:
Option Explicit
Public connLite As ADODB.Connection 'Connection to the Oracle Lite database.
Public g_config As clsConfig
Dim MiscCode(9, 1) As String
Private Sub Form_Load()
Dim inti As Integer
Set connLite = New ADODB.Connection
connLite.IsolationLevel = adXactRepeatableRead
connLite.Open "DSN=ol_mdbs;UID=mdbs;PWD= mdbs;"
Set g_config = New clsConfig
g_config.db_Start connLite
Load_MiscCodes
inti = 0
While MiscCode(inti, 0) <> ""
cboMisc1.AddItem MiscCode(inti, 1)
'cboMisc2.AddItem MiscCode(inti, 1)
'cboMisc3.AddItem MiscCode(inti, 1)
'cboMisc4.AddItem MiscCode(inti, 1)
inti = inti + 1
Wend
If g_config.strMiscType1 <> "" Then
inti = 0
While MiscCode(inti, 0) <> g_config.strMiscType1
inti = inti + 1
Wend
cboMisc1.Text = MiscCode(inti, 1)
End If
'txtMisc1.Text = g_config.strMiscValue1
inti = 0
Text1.Text = "Wow"
End Sub
Public Sub Load_MiscCodes()
Dim inti As Integer
Dim rsCodes As ADODB.Recordset
Set rsCodes = New ADODB.Recordset
rsCodes.Open "Select misccode,description from MDBS.CUSTINFO", connLite, adOpenDynamic, adLockOptimistic
inti = 1
MiscCode(0, 0) = " "
MiscCode(0, 1) = " "
While Not rsCodes.EOF
MiscCode(inti, 0) = rsCodes.Fields!MiscCode
MiscCode(inti, 1) = rsCodes.Fields!Description
inti = inti + 1
rsCodes.MoveNext
Wend
If rsCodes.State <> adStateClosed Then
rsCodes.Close
End If
Set rsCodes = Nothing
End Sub
Anyone having any ideas???
I shortened the problem down into another project file. And it is still doing the same thing. Here is the code:
Option Explicit
Public connLite As ADODB.Connection 'Connection to the Oracle Lite database.
Public g_config As clsConfig
Dim MiscCode(9, 1) As String
Private Sub Form_Load()
Dim inti As Integer
Set connLite = New ADODB.Connection
connLite.IsolationLevel = adXactRepeatableRead
connLite.Open "DSN=ol_mdbs;UID=mdbs;PWD=
Set g_config = New clsConfig
g_config.db_Start connLite
Load_MiscCodes
inti = 0
While MiscCode(inti, 0) <> ""
cboMisc1.AddItem MiscCode(inti, 1)
'cboMisc2.AddItem MiscCode(inti, 1)
'cboMisc3.AddItem MiscCode(inti, 1)
'cboMisc4.AddItem MiscCode(inti, 1)
inti = inti + 1
Wend
If g_config.strMiscType1 <> "" Then
inti = 0
While MiscCode(inti, 0) <> g_config.strMiscType1
inti = inti + 1
Wend
cboMisc1.Text = MiscCode(inti, 1)
End If
'txtMisc1.Text = g_config.strMiscValue1
inti = 0
Text1.Text = "Wow"
End Sub
Public Sub Load_MiscCodes()
Dim inti As Integer
Dim rsCodes As ADODB.Recordset
Set rsCodes = New ADODB.Recordset
rsCodes.Open "Select misccode,description from MDBS.CUSTINFO", connLite, adOpenDynamic, adLockOptimistic
inti = 1
MiscCode(0, 0) = " "
MiscCode(0, 1) = " "
While Not rsCodes.EOF
MiscCode(inti, 0) = rsCodes.Fields!MiscCode
MiscCode(inti, 1) = rsCodes.Fields!Description
inti = inti + 1
rsCodes.MoveNext
Wend
If rsCodes.State <> adStateClosed Then
rsCodes.Close
End If
Set rsCodes = Nothing
End Sub
Anyone having any ideas???
>That is why this is driving me completely nuts. It is like all of those
>boxes are selected at the same time. ????
Are you saying that *ALL* your combo boxes, even when they do *NOT* have the focus and when their drop-down list is *NOT* dropped down, that the text displayed in the TextBox portion of the control is highlighted, as if the I-Beam cursor was in the control and you selected all the text?
-Dennis Borg
>boxes are selected at the same time. ????
Are you saying that *ALL* your combo boxes, even when they do *NOT* have the focus and when their drop-down list is *NOT* dropped down, that the text displayed in the TextBox portion of the control is highlighted, as if the I-Beam cursor was in the control and you selected all the text?
-Dennis Borg
ASKER
Dennis,
This is absoutely correct. One of the text boxes actually has the cursor blinking in it and ALL of the combo boxes have the corresponding text highlighted.
Weird huh??
This is absoutely correct. One of the text boxes actually has the cursor blinking in it and ALL of the combo boxes have the corresponding text highlighted.
Weird huh??
Given you understand what I'm referring to:
Then you have a problem that is not related to how you wrote your program. Rather, you have an issue where you need to reinstall Visual Basic.
There are several controls which have a property named HideSelection. When this property is set to True, the selected text is hidden when the control looses focus (and the text is displayed normally). But when set to False, the text is still displayed in its highlighted form. An example of this is the ListView control.
However, the standard combo box control which ships with VB does not have this property.
-Dennis Borg
Then you have a problem that is not related to how you wrote your program. Rather, you have an issue where you need to reinstall Visual Basic.
There are several controls which have a property named HideSelection. When this property is set to True, the selected text is hidden when the control looses focus (and the text is displayed normally). But when set to False, the text is still displayed in its highlighted form. An example of this is the ListView control.
However, the standard combo box control which ships with VB does not have this property.
-Dennis Borg
The standard combo box automatically hides the selected text (thus displaying the text normally) when it looses the focus.
-Dennis Borg
-Dennis Borg
Try this:
Private Sub Combo1_GotFocus()
Combo1.SelStart = 0
End Sub
Private Sub Combo1_GotFocus()
Combo1.SelStart = 0
End Sub
Gorank..
if you read the above comments, you'll see that I've already suggested that. And it didn't work
My comment was posted on : Monday, October 23 2000 - 02:37PM BST
Also, you should always make suggestions as 'comments' rather than 'answers' (unless you are positive this is the correct response) as this locks the question.
if you read the above comments, you'll see that I've already suggested that. And it didn't work
My comment was posted on : Monday, October 23 2000 - 02:37PM BST
Also, you should always make suggestions as 'comments' rather than 'answers' (unless you are positive this is the correct response) as this locks the question.
ASKER
GoranK,
As smeggshead said that did not work.
In reviewing this form, with people who make the decisions, it has been decided to switch them to Dropdown list. This way nothing can be entered into that box besides what is in the list. Obviously!! I know you all knew that but kept on typing aways.
Well oddly enough when I switched them all to 2- Dropdown List. the problem ceased. No clue why, it just isn't happening on this style. I haven't changed anything else. So since smegghead mentioned about the style I should probably give the points to him.
Thank You all for all the help given to me.
Dave
As smeggshead said that did not work.
In reviewing this form, with people who make the decisions, it has been decided to switch them to Dropdown list. This way nothing can be entered into that box besides what is in the list. Obviously!! I know you all knew that but kept on typing aways.
Well oddly enough when I switched them all to 2- Dropdown List. the problem ceased. No clue why, it just isn't happening on this style. I haven't changed anything else. So since smegghead mentioned about the style I should probably give the points to him.
Thank You all for all the help given to me.
Dave
IT WORKS!!!!!
I've checked again, and it works...
I'm using
Style : 0 - Dropdown Combo
And question was:
I have a number of combo boxes on a form. When I display this form all of the data, in each of the boxes, in the form are highlighted. How can I get this not to happen? it is really starting to irratate me.
For this question, my answer works!!!
I've tested this with 2 combos and it worked. That means, when you show your page with all your combos, nothing would be highlighted...
I've checked again, and it works...
I'm using
Style : 0 - Dropdown Combo
And question was:
I have a number of combo boxes on a form. When I display this form all of the data, in each of the boxes, in the form are highlighted. How can I get this not to happen? it is really starting to irratate me.
For this question, my answer works!!!
I've tested this with 2 combos and it worked. That means, when you show your page with all your combos, nothing would be highlighted...
GoranK:
Somehow, I strongly suspect that you were not experiencing the same phenomona (sp?) which KOCUBA was experiencing:
Having several combo boxes on a form, all of which shows Highlighted Text, even when they do not have the focus.
Are you honestly telling us that you have 2 combo boxes on your form, and *BOTH* AT THE SAME TIME are showing Highlighted Text?!! And that when Combo1 receives the focus, your code (Combo1.SelStart=0) causes *BOTH* combo boxes to display the text in non-highlighted form?
-Dennis Borg
Somehow, I strongly suspect that you were not experiencing the same phenomona (sp?) which KOCUBA was experiencing:
Having several combo boxes on a form, all of which shows Highlighted Text, even when they do not have the focus.
Are you honestly telling us that you have 2 combo boxes on your form, and *BOTH* AT THE SAME TIME are showing Highlighted Text?!! And that when Combo1 receives the focus, your code (Combo1.SelStart=0) causes *BOTH* combo boxes to display the text in non-highlighted form?
-Dennis Borg
ASKER
Yes,
I'm glad it worked for you. But for some reason for me it did not work.
For me switching to the dropdown list worked and it goes in the direction that they want the application to go.
So sorry but I can not award you the points.
I'm glad it worked for you. But for some reason for me it did not work.
For me switching to the dropdown list worked and it goes in the direction that they want the application to go.
So sorry but I can not award you the points.
I've only just recieved email notification of this question's activity... this is becoming a nightmare.
Glad you got it working.... I don't think I've ever used a combobox with a style other than dropdown list (probably just my preference though)
Smeeeeeg.
Glad you got it working.... I don't think I've ever used a combobox with a style other than dropdown list (probably just my preference though)
Smeeeeeg.
Greetings.
This question is still open today, perhaps it was overlooked or just lost in the volumes. Please return to this question to update it with comments if more information is needed to get your solution. If you've been helped by the participating expert(s), you may just convert their comment to the accepted answer and then grade and close. This benefits others who then search our PAQ for just this solution. A win/win scenario.
If you wish to pay multiple participants, you can do so by creating a zero point question in the Community Support topic area, include this link and tell them which experts you'd like to pay what amounts. If you'd like to delete this question, use the same process as above, but explain why you think it should be deleted. Here is the Community Support link: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
You can always click on your profile to see all your open questions, in the event you also have other open items to be resolved. If your number of Questions Asked is not equal to the number of Answers Graded, choose to VIEW question history, and you'll quickly be able to navigate to your open items to close them as well.
I've had excellent help from experts-exchange through the years and find the real key to getting what I need is to remain active in all my questions, responding with results to suggestions until my solution is found, and recommend that highly.
Thank you very much for your responsiveness, it is very much appreciated.
":0) Asta
P.S. Some of the older questions from last year are not in the proper comment date order, and Engineering has been advised.
This question is still open today, perhaps it was overlooked or just lost in the volumes. Please return to this question to update it with comments if more information is needed to get your solution. If you've been helped by the participating expert(s), you may just convert their comment to the accepted answer and then grade and close. This benefits others who then search our PAQ for just this solution. A win/win scenario.
If you wish to pay multiple participants, you can do so by creating a zero point question in the Community Support topic area, include this link and tell them which experts you'd like to pay what amounts. If you'd like to delete this question, use the same process as above, but explain why you think it should be deleted. Here is the Community Support link: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
You can always click on your profile to see all your open questions, in the event you also have other open items to be resolved. If your number of Questions Asked is not equal to the number of Answers Graded, choose to VIEW question history, and you'll quickly be able to navigate to your open items to close them as well.
I've had excellent help from experts-exchange through the years and find the real key to getting what I need is to remain active in all my questions, responding with results to suggestions until my solution is found, and recommend that highly.
Thank you very much for your responsiveness, it is very much appreciated.
":0) Asta
P.S. Some of the older questions from last year are not in the proper comment date order, and Engineering has been advised.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I ran into the problem of populating several combo boxes on a form and having them all show up highlighted - just like the problem described here. While turning them all into the DropDownList style eliminates the highlighting problem - that's not a great solution because that's not the style desired for the control. I have found a trick that works.
While you are constructing and populating the combbox set it to the DropDownList style. Then override the OnEnter method of the ComboBox and if you want a different style set your DropDownStyle there before called base.OnEnter(). Works like a charm.
While you are constructing and populating the combbox set it to the DropDownList style. Then override the OnEnter method of the ComboBox and if you want a different style set your DropDownStyle there before called base.OnEnter(). Works like a charm.