Hi!
I have several textfiles on disk like:
Thing 1
Thing 2
etc...
On a form I have two combo-boxes. When user chooses from Combo1
(predefined items) I want the second combo-box to load the text files
according to which item user chooses in Combo1.
Is there anybody that know how I do this?
The reason why is because the textfiles contain so much text (and are
so many) I don't want to put it in the code like:
if Combo1.ListItem = 0 then
Me!Combo2.Items .Rowsource = "Thing 1;Thing 2; etc"
End if
The textfiles will also be altered from time to time, but will always
contain items belonging to Combo1.
Thanks!
Me.Name 8 3081
'Me!Combo2.Item s.Rowsource = "Thing 1;Thing 2; etc"'
How bout you read the items from the text file into an output string
stream(or just append to a regular string) using a loop that gets each
line into the string and appends a ';', then assign the string to
RowSource.
If I were you though, I would create a table and paste the items from
the text file into the table, then you can use an SQL query for your
row source:
SELECT MyListOfOptions FROM MyTable;
If you ever want to edit the options available, then it's as easy as
editing the table.
Geir Baardsen wrote: Hi!
I have several textfiles on disk like:
Thing 1 Thing 2
etc...
On a form I have two combo-boxes. When user chooses from Combo1 (predefined items) I want the second combo-box to load the text files according to which item user chooses in Combo1.
Is there anybody that know how I do this?
The reason why is because the textfiles contain so much text (and are so many) I don't want to put it in the code like:
if Combo1.ListItem = 0 then
Me!Combo2.Items .Rowsource = "Thing 1;Thing 2; etc"
End if
The textfiles will also be altered from time to time, but will always contain items belonging to Combo1.
Thanks!
Me.Name
You can string them together as mentioned in another post. A problem
may occur since the string that can be concatenated is limited. I'm not
sure...it may be 2048 characters.
Check out RowSourceType and then find the info for creating a
UserDefinedForm at. Then you can have large sets of data...but you
should be able to program.
Hey Steve Jorgensen or Lyle,
can you do this kind of thing in ADO? basically, read a delimited
textfile into a recordset-type thing (virtual table, essentially) and
then assign the result as the rowsource for the combobox? I would
think that you could call it by doing something like
Function CreateList(byva l strFileName as string) As ADODB.Recordset
.... or some such thing. pi********@hotm ail.com wrote: Hey Steve Jorgensen or Lyle, can you do this kind of thing in ADO? basically, read a delimited textfile into a recordset-type thing (virtual table, essentially) and then assign the result as the rowsource for the combobox? I would think that you could call it by doing something like
Function CreateList(byva l strFileName as string) As ADODB.Recordset ... or some such thing.
Surely the listbox simply translates the "recordset-type thing" to a
string anyway, so why would one translate the string to a recordset first?
Assuming you can read the textfile just set the row source type to
valuelist, and the rowsource to the string. I often do my list and combo
boxes this way even when they are based on a query.
--
--
Lyle
"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
In news:Eh******** *************@r ead2.cgocable.n et,
Lyle Fairfield <ly******@yahoo .ca> said: pi********@hotm ail.com wrote: Hey Steve Jorgensen or Lyle, can you do this kind of thing in ADO? basically, read a delimited textfile into a recordset-type thing (virtual table, essentially) and then assign the result as the rowsource for the combobox? I would think that you could call it by doing something like
Function CreateList(byva l strFileName as string) As ADODB.Recordset ... or some such thing.
Surely the listbox simply translates the "recordset-type thing" to a string anyway, so why would one translate the string to a recordset first? Assuming you can read the textfile just set the row source type to valuelist, and the rowsource to the string. I often do my list and combo boxes this way even when they are based on a query.
Isn't there a limit on the length that string can be?
--
regards,
Bradley
A Christian Response www.pastornet.net.au/response
Br@dley wrote: In news:Eh******** *************@r ead2.cgocable.n et, Lyle Fairfield <ly******@yahoo .ca> said:
Assuming you can read the textfile just set the row source type to valuelist, and the rowsource to the string. I often do my list and combo boxes this way even when they are based on a query.
Isn't there a limit on the length that string can be?
I can't comprehend a list box with so many choices that it approaches
any limit whatever, After 20 or so choices I find a different way. A
list box of a few thousand items is, IMO, quite ludicrous. SO my answer
is, "Dunno, Don't Care!".
There is a limit to the size of any list. Of course that's not including
the list of Texas executions which is infinite, but these are Divine
works of Men of God!
--
--
Lyle
"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
Lyle Fairfield wrote: Br@dley wrote:
In news:Eh******** *************@r ead2.cgocable.n et, Lyle Fairfield <ly******@yahoo .ca> said:
Assuming you can read the textfile just set the row source type to valuelist, and the rowsource to the string. I often do my list and combo boxes this way even when they are based on a query.
Isn't there a limit on the length that string can be?
I can't comprehend a list box with so many choices that it approaches any limit whatever, After 20 or so choices I find a different way. A list box of a few thousand items is, IMO, quite ludicrous. SO my answer is, "Dunno, Don't Care!".
I agree a few 1000 items is overkill. 20 choices? What happens if you
have 21 items? A list/combobox can handle more easily enough.
If you have a few rows but lots of columns you run out of string space.
The best way to do it is to create a user defined function. Using a
string is useful for small numbers of rows/cols. There is a limit to the size of any list. Of course that's not including the list of Texas executions which is infinite, but these are Divine works of Men of God!
Guys,
Whatever happened to callback functions. These were all the rage with
Access 97. If they are still supported then you can supply the data to your
function any which way. The mvp site should have samples of these.
--
Alan Webb kn*******@SPAMh otmail.com
"It's not IT, it's IS"
"Geir Baardsen" <ge***********@ hotmail.com> wrote in message
news:35******** *************** ***@posting.goo gle.com... Hi!
I have several textfiles on disk like:
Thing 1 Thing 2
etc...
On a form I have two combo-boxes. When user chooses from Combo1 (predefined items) I want the second combo-box to load the text files according to which item user chooses in Combo1.
Is there anybody that know how I do this?
The reason why is because the textfiles contain so much text (and are so many) I don't want to put it in the code like:
if Combo1.ListItem = 0 then
Me!Combo2.Items .Rowsource = "Thing 1;Thing 2; etc"
End if
The textfiles will also be altered from time to time, but will always contain items belonging to Combo1.
Thanks!
Me.Name This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pepehammer |
last post by:
Hi everybody!
I got a combobox to fill.
I want to display some information (Text), but when I select a item, I want
to return a number.
The info I want to fill in is something like this:
TEXT VALUE
Category1 10
|
by: Maurice Mertens |
last post by:
Hi all,
In VB.NET you can set the DropDownStyle for a combobox to 'DropDown' or
'DropDownList'. When you set it to DropDownList, it supports auto-fill. But
when you set it to 'DropDown', the auto-fill support is gone.
How can I get auto-fill on a combobox with a dropdownstyle 'DropDown'?
--
|
by: ken |
last post by:
I would like to fill a combobox with the values of one
column of the dataview I am using. When I set it up the
way I expect it would be, I get every row in the combobox
says: System.Data.DataRowView
If I click on one, it navigates to the right place. Any
idea how I would get the System.Data.DataRowView to show
the actual values in the...
|
by: sparkle |
last post by:
Hi Everybody,
I'm filling a combobox from a class, which works fine on it's own.
But when I insert code to fill in other controls something in the
combobox fill is causing the SelectedIndexChanged event to happen
when the form (hence combobox) loads, not when I select something
from the combobox.
Do I have something in the wrong order?...
|
by: Sakharam Phapale |
last post by:
Hi All,
How to fill one ComboBox from other ComboBox control?
1) Only setting the reference does the trick but doesn't show items in
control. If you see in immediate window, it shows the item count correctly
| |
by: Simon Verona |
last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as
well..
I have a combobox that is bound to a dataview generated from a dataset.
The dataset has a single table (called "Data") with two columns "Id" and
"Description". Id contains a code and description contains the
description that is displayed in the...
|
by: hung tran |
last post by:
Hi,
I'd like to drop down a combobox after validating the Leave() event, how
can I do that ?
Thanks
|
by: Tark Siala |
last post by:
hi dear
i'm programmer with VB6, but now i starting with C#.
first problem is coming when i need fill "ComboBox Control", as you know
when i fill combobox in VB6 by this code:
comboX.AddItem "Monday"
comboX.ItemData (comboX.NewIndex) = 1
comboX.text = ComboX.List(0)
where:
|
by: Crazy Cat |
last post by:
Hi all,
I have combobox that is bound to a custom object collection thusly
Dim collection As List(Of StructureType) =
StructureType.FindStructureTypes(SharedObjects.StructureTypes,
DropDownListStructure.SelectedValue, DropDownListType.SelectedValue)
DropDownListSubType.DataSource = collection
DropDownListSubType.DisplayMember =...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |