Programming VB.net Help plz...

renvilo

Well-Known Member
Joined
Jan 28, 2008
Messages
485
Hi guys,

I am doing my second program for the company. Everything seems fine I just have 1 prob at the mo...

The 1 page is a survey. It looks like this:

Poor Fair Satisfactory Good Excellent

Verbal skills:
General attitude:



At the moment they mark a "x" in the headings to say if it was good or bad. I want to do this in VB.net and insert Radio buttons and when they click save it has to be saved to a SQL DB. The DB is setup with the Questions as a field.

How can I set a value to radio buttons? Like Poor = 1 ; Fair = 2 ; Satisfactory = 3...... and when "save" is clicked it save's that Value to the DB.

What should the "Type" be in the DB as well? Int? VarChar?

Thanks guys
 

renvilo

Well-Known Member
Joined
Jan 28, 2008
Messages
485
I'm using a dataset to link the program to my DB. What source do you need... There's not much going on in there, lol... I'm using VS2005 coz I'm not a pro programmer, yet :)

I was thinking of making non visable text boxes under each radio button but that sound stupid to me... There has to be a way of putting a X value to save thru to a DB

OR

I can make 5 columns for Every Question and that can save the True value if the radio button has been selected. That also sounds a bit stupid to me...

Google works but it's limited to my limitations of typing a questions.. Like :

Google -> How to set a value to a Radio button + VB.net

Doesn't help much, lol
 

jurkrit

Well-Known Member
Joined
Apr 25, 2008
Messages
136
What you could do is use a Case statement or an If statement in the code behind.

Eg .

select case radiobutton.value
case "good"
rating = "good"
case "bad"
rating = "bad"
end select

and the store the "rating" in the db as a varchar or even better, use a lookup table and store it as a foreign key.
 
Last edited:

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
using an enumaration for the comparison would be better.
 

jurkrit

Well-Known Member
Joined
Apr 25, 2008
Messages
136
True, It was just the general idea i was trying explain.

Don't want to do the whole thing for him.
And beside as renvilo said "I'm not a pro programmer, yet", so would he know what a enumaration is?
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
True, It was just the general idea i was trying explain?
i know :), but typing out strings values as words in code behind all the time can lead to other issues, hence enumeration be better as it is for example once of Enumerations.Rating == <user input device>.

beside as renvilo said "I'm not a pro programmer, yet", so would he know what a enumaration is?

begin into programming means you have to learn to be resourceful; hence if something is unkown you go research and understand it- basic school 101.
 
Last edited:

renvilo

Well-Known Member
Joined
Jan 28, 2008
Messages
485
lol.. May I ask why?

Edit: First time I made a app I was using VB 6... VS is just easier for some stuff... The build in features are just waaaayyyyy better... But yea think most people are using VS these day :)

But still learning a lot so... One day I might get a job next to 1 of you :)
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
sqlDB
i would use a lookup table (LURating) being ID, Name and then it the questionaire table (Questionair) store it as int being IDRating which can be then linked with the lookup to provide the actual string value for example Good. put in place restrictions for example the lookup table would need to have restrictions on it ea. name of rating.
 

jurkrit

Well-Known Member
Joined
Apr 25, 2008
Messages
136
i know :), but typing out strings values as words in code behind all the time can lead to other issues, hence enumeration be better as it is for example once of Enumerations.Rating == <user input device>.



begin into programming means you have to learn to be resourceful; hence if something is unkown you go research and understand it- basic school 101.

We know that yes, but be honest in your first or second piece of code you wrote, did you use Enumerations ? I didn't but as you go on you learn by mistake and then start using Enumerations.
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
We know that yes, but be honest in your first or second piece of code you wrote, did you use Enumerations ? I didn't but as you go on you learn by mistake and then start using Enumerations.

i did actually, thats how i was taugh where i learnt to code.
 

jurkrit

Well-Known Member
Joined
Apr 25, 2008
Messages
136
lol.. May I ask why?

Edit: First time I made a app I was using VB 6... VS is just easier for some stuff... The build in features are just waaaayyyyy better... But yea think most people are using VS these day :)

But still learning a lot so... One day I might get a job next to 1 of you :)

I still use VS2005 every day of my life ;)
 
Top