Hai Arpaket,
Now I am clear ie what u need
First set the properties for the combo box
DropDownStyle = DropDownList
Add the item dynamically as previous but don't change font in that loop
instead of that you can write the procedure in n
SelectionChangeCommitted event
(See in event properties)
Private Sub CurComboBox_SelectionChangeCommitted(ByVal sender AsSystem.Object,
ByVal e As System.EventArgs) Handles CurComboBox.SelectionChangeCommitted
If CurComboBox.Text.Contains("a") Then
CurComboBox.Font = New Font("Arial", 8, FontStyle.Italic)
CurComboBox.BackColor = Color.Wheat
Else
CurComboBox.Font = New Font("Arial", 8, FontStyle.Regular)
CurComboBox.BackColor = Color.White
End If
End Sub
This event occurs when user select the item from combo box
When the even t fire check the current text contains "a" if it true then
change the font style and color so this will highlighted as your desire
I think this is satisfy you
I am wait for your reply
2008/12/20 Arpaket <[email protected]>
>
> Thanks for you response, Sharp. Sorry I was obtuse. Using your code,
> what I would like to be able to do is something like this:
>
> CurComboBox.Items.Clear()'clear the previous Items
> For Each s In CurItems 's is an string CurItems is array of string
> CurComboBox.Items.Add(s) 'add item
> If s.contains("a") then
> CurComboBox.SelectedItem(s).Font.Italic
> else
> CurComboBox.SelectedItem(s).Font.Regular
> end if
> Next
>
> OK, so I'm making some things up, but what I'm driving at is: If my
> string contains an a, then I want that item in the ComboBox to be
> italicized (or Bold, or a different Font, etc.). If it doesn't then
> that element would be, whatever, not italic. Can I do this with
> ComboBox? Of course SelectedItem(s).Font doesn't work. Is there
> another way?
>
>
> On Dec 19, 8:54 am, Sharp ArunKumar <[email protected]> wrote:
> > Hai, Arpaket
> > I can't able to fully understand what you need any way
> >
> > See the following code for dynamically add item to combobox
> >
> > CurComboBox.Items.Clear()'clear the previous Items
> > For Each s In CurItems 's is an string CurItems is array of string
> > CurComboBox.Items.Add(s) 'add item
> > Next
> > Do you want to occur the event when user select the item in combobox
> > Then write in DropDown closed event
> >
> > On Dec 18, 11:16 pm, Arpaket <[email protected]> wrote:
> >
> > > Using VB.Net: I need to fill in a ComboBox with items that can be
> > > highlighted according to their kind. Like BIG or small. Can I do
> > > this with code dynamically in the ComboBox? If so, I don't know how
> > > and sorry to be so stupid but you could help me. TIA.
>
--
Regards
*******************
*C.Arun Kumar *
*******************