help guys,

i want to check the Open radio button if the data in the database is "Open" otherwise, the Close radio button is checked.

i badly need you help..\\thanks

Give some more information about your problem.

I'm not sure of what u meant, if u mean that the database connection is open then U can just put a value which checks for the connection.open() and according to the value returned selects the check box.

here's the situation,

i have two radio buttons..rbtnOpen and rbtnClose..i checked the rbtnClose. and saved the value to the database...

now, i want to reverse the situation..from the database then to radio button which is rbtnClose..i want to mark the rbtnCLose as checked

I still did not get ur question, but u can take a datagridview and within a for loop check for the value u are looking for from a data set.
If the value exists, then radio button is checked, else leave it un checked.

Here's a simple idea for your problem. If you need a code sample, then tell me.

Now I will give you the idea like a story ok.

* Open the connection
* Assign the result of the buttons for a value, as an EXAMPLE,
First create an empty string value "resultBtn".
If you have checked the rbtnOpen then it will assign a value to "resultBtn" as "OpenChecked" or if you have checked the rbtnClose then it will assign a value to "resultBtn" as "CloseChecked".
* Then create a column in the database for save the changes of the Radio Buttons. That means, if the rbtnOpen is checked then dbBtnResult(consider "dbBtnResult" as an example for the column in the database to save the changes of the Radio Buttons) will have the value of resultBtn.
* Close the connection.

That's the way how to save the the changes of the radio buttons. Then lets see how to load back the changes to that radio buttons.

As an example, consider that we have to click on a push button named "Button1" to load the data.
* First, on the "Button1" click event,
Open the database connection.
* Assign an empty string value. (As an example consider "strBack" as this string name)
* Load the "dbBtnResult" data to the value of "strBack". That means now "strBack" has the string value as "OpenChecked" or "CloseChecked".
* Now create an If-else loop. As an example see below.
If strBack = "OpenChecked" Then
rbtnOpen.Checked = True
Else
rbtnClose.Checked = True
End If
* At last Close the database connection.

So this is the thing. This is only a simple idea. I like if you try this way by your own code. Then send me a reply.

commented: Really Helpful, Thanks +0

Here's a simple idea for your problem. If you need a code sample, then tell me.

Now I will give you the idea like a story ok.

* Open the connection
* Assign the result of the buttons for a value, as an EXAMPLE,
First create an empty string value "resultBtn".
If you have checked the rbtnOpen then it will assign a value to "resultBtn" as "OpenChecked" or if you have checked the rbtnClose then it will assign a value to "resultBtn" as "CloseChecked".
* Then create a column in the database for save the changes of the Radio Buttons. That means, if the rbtnOpen is checked then dbBtnResult(consider "dbBtnResult" as an example for the column in the database to save the changes of the Radio Buttons) will have the value of resultBtn.
* Close the connection.

That's the way how to save the the changes of the radio buttons. Then lets see how to load back the changes to that radio buttons.

As an example, consider that we have to click on a push button named "Button1" to load the data.
* First, on the "Button1" click event,
Open the database connection.
* Assign an empty string value. (As an example consider "strBack" as this string name)
* Load the "dbBtnResult" data to the value of "strBack". That means now "strBack" has the string value as "OpenChecked" or "CloseChecked".
* Now create an If-else loop. As an example see below.
If strBack = "OpenChecked" Then
rbtnOpen.Checked = True
Else
rbtnClose.Checked = True
End If
* At last Close the database connection.

So this is the thing. This is only a simple idea. I like if you try this way by your own code. Then send me a reply.

can you give me a sample code?

Ok i will send you a zip file which contains a sample vb code and a database.
I can send it to your email. Just give me your email.

Have you got the email, i have sent you a zip file. Please check it out now, and give me reply.

got it..thanks much..:)

it was really helpful..thanks a lot..problem solved..:)

anyways, you have from checkboxlist to database and vice versa?

Ok, You welcome.

You have to do the same thing for checkboxes like these radio buttons. This is a simple method, but in advanced programming, we can do better. Learn hard, code hard, then you got the way.

And don't forget to mark this thread as "Solved", ok dear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.