473,388 Members | 1,468 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,388 software developers and data experts.

ComboBoxes

10
Hello everyone. I am a new visual basic.net programmer and was wondering if someone could help me with a small problem?
Here is what I have.
I've got 2 ComboBoxes named cboModel and cboFinish.
I'm wanting to display the selected Model and Finish- example:
Model 2121 Finish M
and I want to display the selected items to a listbox all on one line, such as 2121M when either selected or with an enter button, either one would be fine, as long as I could populate the listbox.
May 19 '07 #1
8 1355
shidec
26
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
  3.     ListBox1.Items.Add(cboModel.Text & " " & cboFinish.Text)
  4. End Sub
  5.  
May 20 '07 #2
brvan41
10
I sure want to thank you for the fix. I appreciate it. Maybe I could offer the same for you or someone else as I gain experience.
I don't want to sound greedy, but is there a way to also record the date and time next to each of those items? I need to record the date and time it was entered into the listbox.
Thank you and GodBless
Brett
May 20 '07 #3
shidec
26
use Date object.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  2.         ListBox1.Items.Add(Date.Now.ToString() & " " & cboModel.Text & " " & cboFinish.Text)
  3. End Sub
  4.  
May 21 '07 #4
brvan41
10
Shidec,
Thank You very much and may GodBless you richly. I sincerely hope to return the favor someday.
Thanks again from the Newbie,
Brett
May 21 '07 #5
brvan41
10
Is there any way that I can write these items that are being written to my listbox with those dates, Model and Finish to a file? I'm wanting to put a print button on the form to print what we have produced.
I would like this form to be in such a way that, at the end of the day, only the items in my comboboxes are the only ones to be saved.
I'm sorry, it sounds like a lot.
Thank you again, and have a great day
May 23 '07 #6
Frinavale
9,735 Expert Mod 8TB
Is there any way that I can write these items that are being written to my listbox with those dates, Model and Finish to a file? I'm wanting to put a print button on the form to print what we have produced.
I would like this form to be in such a way that, at the end of the day, only the items in my comboboxes are the only ones to be saved.
I'm sorry, it sounds like a lot.
Thank you again, and have a great day

Have you done research on how to write to a text file?
Check out this .NET Tutorial on how to write to a text file using VB.NET
May 24 '07 #7
brvan41
10
Thank You very much and yes, I don't have a problem writing to the file. I've tried everything to print.
Here is what I have so far:
Expand|Select|Wrap|Line Numbers
  1. Dim datListBox1 As New StreamWriter("ListBox1.txt") 'This opens the file
  2.         Dim intIndex As Integer
  3.         Dim intMaximum As Integer
  4.  
  5.         intMaximum = ListBox1.Items.Count - 1
  6.         For intIndex = 0 To intMaximum
  7.             datListBox1.WriteLine(ListBox1.Items(intIndex))
  8.         Next intIndex
  9.         datListBox1.Close()      'Close the file
  10.  
The last line is supposed to be: mblnIsDirty = False
Would I include the mblnIsDirty in a module?
I think that the line of code is if there was any changes made, I think.
Everytime I enter that last line it tells me It is not declared, but I don't know where to declare it. On that issue anyway. But it is saving it. Now I just don't know how to print the items. Here is what I have tried:
Expand|Select|Wrap|Line Numbers
  1.  'Print out all items in the Listbox list
  2. For intListIndex = 0 to ListBox1.Items.Count - 1
  3.  
  4.  ' set up a line    
  5. strPrintLine = CStr(ListBox1.Items(intListIndex)
  6.  
  7.  ' Send the line to the graphics page object
  8.  e.Graphics.DrawString(strPrintLine, fnPrintFont, Brushes.Black, sngPrintX, sngPrintY)
  9.  
  10.  ' increment the Y position for the next line
  11. sngPrintY += sngLineHeight
  12.  
I put the code in the Handles btnPrint.Click

But I get the same thing it says that well I get a lot os syntax errors
anyway, any help would be greatful. I just want to push the button and printing starts. Sounds easy, but having trouble.
Thank You for the reference web page. I'll check there for the print method also.
Have a good day
May 25 '07 #8
Frinavale
9,735 Expert Mod 8TB
Thank You very much and yes, I don't have a problem writing to the file. I've tried everything to print.
Here is what I have so far:
...
anyway, any help would be greatful. I just want to push the button and printing starts. Sounds easy, but having trouble.
Thank You for the reference web page. I'll check there for the print method also.
Have a good day
Have you seen this article on Printing in Visual Basic .NET ?
May 25 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Kathy | last post by:
In my custom menu one menu item opens a form to add new Makes to TblMakes and another menu item opens a form to add new Models to TblModels. I have a form that has a combobox for Makes and a...
0
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set...
1
by: Craig G | last post by:
for months we have been dabling round looking at various 3rd party comboboxes that allow the user to type text into the combobox as a search mechanism what we've found is that the likes of...
1
by: Marcin Podle¶ny | last post by:
Hi, I've a form with three comboboxes. Each of them contains the same data - all cities in my country. As you see it's a lot of data so it takes a lot of memory. I'd like to use the same...
6
by: Sam | last post by:
Hi, I have a datagrid which has (amongst other stuff) 2 comboboxes columns. So far so good. The trick is that when I select a value in my first column, it must updates the items of the combobox in...
2
by: ashishtarlekar | last post by:
Hi all, I have to add comboboxes in the first row of datagridview for mapping the database fields. For e.g. I have to show Id, FirstName, LastName in each comboboxes in the first row. if i select...
2
by: Matt | last post by:
Hi all, me again! :) I've now got an issue with combo boxes. Basically, I have a number of items that I want a user to pick from a single list. It's basically along the lines of: Fruit 1: ...
3
by: Randy | last post by:
I have a routine that creates a series of comboboxes, each of which is bound to a common dataview. Everything used to work fine, but now, when I change the value of any of the comboboxes, the...
5
by: Anthony Bollinger | last post by:
I have two tables in a master-detail relationship. When I make a selection in one combobox, how do I have it display the values from a second combobox? Each table has a key and a text value for...
2
by: Wingot | last post by:
Hey, I have a view to a database that I have created for Client Maintenance. It has a number of fields, but the important ones are Medical Condition, Bill To, and Country. I have a couple of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

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.