Several Issues with Comboboxes

Dcurvez

Member
Joined
Apr 8, 2010
Messages
18
Programming Experience
Beginner
hi all :)

wondering if someone can help me some small issues I am having with building my first project.

1.

I have comboboxes that allow users to enter their own choices in and then their choices are displayed into the gridview.

the problem I am having is this is allowing me to duplicate choices. for example:
when I run debug to try my boxes, I can type in Johnathan into the combobox as many times as I want to and it adds is to the combobox list..so now I got 10 johnathans in my combo box....LOL...:(..and then to make things worse, when I hit the button I made to send choices to display..it causes duplicated choices to show up in the display.

What I figure is that it is easier for me to just prevent duplicates in combobox.

2.

Lets say on one of 10 comboboxes I got...lets say someone skips the box and doesnt make a choice...my grid will then display the last choice made.. (man o man)
for example:

John chose in his boxes and is displayed on gridview: Combobox1 (john) Combo2 (5:00 PM) combo3 (waiting)

now lets say I come up to the computer and in Combobox1(Dcurvez) Combo2( i skipped and didnt enter a choice) and Combobox3(In Progess)

The display will put Dcurvez....5:00 PM.....In Progress

because I didnt make a choice in the time combobox..it put in the last choice (Johns) as 5:00 PM


Can someone in very simple terms tell me how to fix this problem?? please??


I am using visual studio 2008

and vb/vb.net as language

this is not a webpage, btw. it is for in shop computer just.
 
1. First, don't allow people to type directly into your combo box. I always use a textbox. That makes it easier to check for duplicates.
VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ComboBox1.FindStringExact(TextBox1.Text) > -1 Then
            MessageBox.Show(TextBox1.Text & " already exists in the combo box.", "Item Not Added", MessageBoxButtons.OK)
        Else
            ComboBox1.Items.Add(TextBox1.Text)
            MessageBox.Show(TextBox1.Text & " added to the combo box.", "Item Added", MessageBoxButtons.OK)
        End If

    End Sub
2. Force them to enter something in all three or do not accept the entires into any of them.
 
okay thank ya!

okay Hack, thank ya for helping me with some of this.

I am so very new at all of this, and the reason why I am using comboboxes to begin with is because the users are a buncha tire shop guys that really arent very good at typing AND the boss lady would like to have something that the guys can just locate and click on LOL..sheesh!
I didnt use text boxes because that doesnt give me that option...or does it?

Secondly...I went with comboboxes because I really dont know what the time frames are these guys take or the extense that they do it in. For example: they do tires...I do know that it would entail: tire change, balancing, rotating..yadda yadda yadda..but with so little information..I cant really fill in the boxes with premade choices. LOL..I have no idea how long it takes on the average to rotate tires!

But if they were to make the initial entries and pretty much start to build their own boxes, with in a small amount of time, the boxes would be populated with what they need..theoretically(spelling)...anyways, as I said I dont know much but am trying really hard to make this happen.

as far as forcing them to fill in all fields, can you please give me an example of how to make that happen? as the fields that I have are all important and do need to be filled in.

Again I thank you for helping me..I can at least solve some of this mess :)
 
I am so very new at all of this, and the reason why I am using comboboxes to begin with is because the users are a buncha tire shop guys that really arent very good at typing AND the boss lady would like to have something that the guys can just locate and click on LOL..sheesh!
I didnt use text boxes because that doesnt give me that option...or does it?
No, it doesn't give you that option...but now you have me confused. If all these guys are doing is clicking and picking then who is doing all the typing causing the duplicates?
I can type in Johnathan into the combobox as many times as I want to and it adds is to the combobox list..so now I got 10 johnathans in my combo box....LOL
You??? :confused:

If it is you, then you can solve your own problem by not typing in the same name 10 times.
 
Lol

heheheeeeee sheeeeesh!!

naw this isnt out for use yet, I noticed this wa happening in debug LOL and seen that later on it would become an issue LOL.

what is going on here is that inadertanly soemone on that end will type in the fields and then they would save them to the gridview. but by letting them initially set up their own like this then later, the choices would become premade. In other words, I (the user) might have to initially type in these things..but then later on as time progresses the need for type would not be an issue.
 
Why don't you set up a little database?

Put all the shop guys names in a table and load your combo/grid/whatever directly from the database table?

If you get a new guy, then you add his name to the database table.

If someone leaves, then remove his name from the database table.

Noone, except the person maintaining the database table, has to type anything.
 
well because

because I am tooo new at this.
I started out trying to do just that. But I had no idea as how how to set up a little database inside of my project, so I started out with the combo boxes.
And then I ran into the issue of "well thats all fine and dandy But you still have the issue as to how your going to save the dataview grid contents."

And so after days and days of searching and asking around everyone kept saying Database, database, database. Well I spent days trying to get around it (cuz I thought you had to be web based to use a database) I did not understand sql...local server...all of that. But I couldnt solve the issue by doing that either :(
so what finally did happen was I did break down and start looking into this database thing. I finally found Tim Laytons tutorial on youtube..he showed how to do it on this video. I thought...oooOOO okay...i can do this, this is easy enough to follow and understand. SO I did. I set up a database. had table and dataset and everything.
But then I was left holding the bag (so to speak) because now..I had a gridview, I had a database, I had comboboxes displaying to dataview...but still no idea as to how I was going to get the contents of the datagridview to the database. I emailed Tim Layton (3days ago) out of desperation and point blank explained to him and asked him if he could help me. I still havent heard nothing back from him :(.

So, now what is happening is I have this person over at Dani who has taken the time (days) to show me how I could take the contents of my datagridview and save them and even import it into excel :) which is so very nice because the lady I am trying to do this for uses excel.

so as it sits now I have in my form a data table that is no good to me cuz i still dont know how to get the datagridview to save to it.

*I need ta take a breath here!* LOL
 
Back
Top