473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Set the default "initial" value of a ComboBox

I have populated (or created a collection) in a ComboBox. However - I would like to set a default value - when my form is first opened (for the ComboBox) - like "Select topic"

However - when I attempt to add this text to the Text property of the Combobox - it does not take. In other words, I type it in the property - but when I leave the field - it is blank. I also tried modifying the ComboBox control - in the following manner

'ComboBox

Me.ComboBox1.Items.Add("1"
Me.ComboBox1.Items.Add("2"
Me.ComboBox1.Items.Add("3"
Me.ComboBox1.Items.Add("4"
Me.ComboBox1.Location = New System.Drawing.Point(56, 38
Me.ComboBox1.Size = New System.Drawing.Size(176, 22
Me.ComboBox1.Text = "Select Topic

I added the last line "Me.ComboBox1.Text = "Select Topic" - but again - it would not apply the value - when I sent to the emulator.

Why is that?
Nov 20 '05 #1
2 40472
* "=?Utf-8?B?S2VpdGg=?=" <an*******@discussions.microsoft.com> scripsit:
I have populated (or created a collection) in a ComboBox. However - I would like to set a default value - when my form is first opened (for the ComboBox) - like "Select topic".


Set the control's 'SelectedIndex' property.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
You want "SelectedItem," not "Text."

--George

"Keith" <an*******@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
I have populated (or created a collection) in a ComboBox. However - I would like to set a default value - when my form is first opened (for the
ComboBox) - like "Select topic".
However - when I attempt to add this text to the Text property of the Combobox - it does not take. In other words, I type it in the property -
but when I leave the field - it is blank. I also tried modifying the
ComboBox control - in the following manner:
'ComboBox1
'
Me.ComboBox1.Items.Add("1")
Me.ComboBox1.Items.Add("2")
Me.ComboBox1.Items.Add("3")
Me.ComboBox1.Items.Add("4")
Me.ComboBox1.Location = New System.Drawing.Point(56, 38)
Me.ComboBox1.Size = New System.Drawing.Size(176, 22)
Me.ComboBox1.Text = "Select Topic"

I added the last line "Me.ComboBox1.Text = "Select Topic" - but again - it would not apply the value - when I sent to the emulator.
Why is that?

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: TTroy | last post by:
Hi, I'm just wondering why people/books/experts say "the function returns a pointer to.." or "we have to send scanf a pointer to.." instead of "the function returns the address of.." or "we have...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
8
by: Peter Merwood | last post by:
I'm using some sample code from MSDN. The code includes the following statement: Dim content as = .Empty I'm not familiar with the use of the square brackets. Can someone please explain to...
12
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL...
7
by: Carsten H. Pedersen | last post by:
Hello I want to create a kind of shared object. I have created a class, Counter, which you can then import. Through the Counter class, i would like to have access to a shared object. Lets say...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
7
by: Ziyan | last post by:
I am writing a C/C++ program that runs in background (Linux). Therefore, normally no output would be written into standard output. However, sometimes I want to have debug message collected and sent...
1
by: Rob | last post by:
I am doing a simple setup deployment.... everything is fine but the program installs to the Program Files\Default Company Name.... I hear that is derived from the "Manufacturer".... Where do...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.