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

A radio button from VB.Net to Access

Hi,

So I`m connecting an application to Access. Im only writing to Access. I am writing textboxes now. Now I want to write Radio buttons and checkboxes, and I need your help.

I am using this code:

Imports System.Data.OleDb
Imports System.Data.DataRow
Public Class Form1

Private MiConexion As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=|DataDirectory|\bd1.mdb")
Private MiAdaptador As New OleDbDataAdapter("SELECT * FROM Nombres", MiConexion)
Private MiDataSet As New DataSet()
Private MiEnlazador As New BindingSource

Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
If (e.KeyChar = Chr(Keys.Enter)) And (Me.TextBox1.Text.Length > 0) Then
Dim nombre As DataRow
nombre = MiDataSet.Tables(0).NewRow()



nombre("Nombre") = TextBox1.Text
nombre("Telefono") = TextBox2.Text
MiDataSet.Tables(0).Rows.Add(nombre)



Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
Me.ComboBox1.SelectedIndex = Me.ComboBox1.Items.Count - 1








End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim commandbuilder As New OleDb.OleDbCommandBuilder(Me.MiAdaptador)
MiConexion.Open()
MiAdaptador.Fill(MiDataSet)
MiEnlazador.DataSource = MiDataSet.Tables(0)
Me.ComboBox1.DataSource = MiEnlazador
Me.ComboBox1.DisplayMember = "Nombre"
Me.ComboBox1.ValueMember = "Id"
Me.TextBox1.Select()
End Sub


Private Sub Guardar(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.MiAdaptador.Update(CType(Me.MiEnlazador.DataSou rce, DataTable))
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class
Oct 4 '07 #1
0 2466

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

Similar topics

2
by: Paul Thompson | last post by:
I am trying to use various javascript tools, all of which work in NN, to work in IE. Here's my latest annoyance. I get a list of all objects on a page using docContents =...
6
by: Ken Loomis | last post by:
Hello: On a web page I check the value of a cookie and set one of two radio buttons accordingly. function setRadioForm() { var myCookie = document.cookie; var OpenOnly =...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
1
by: Rage Matrix | last post by:
Hi all, I have a small problem with Access radio button groups in VBA. I've got a radio button group called fraSearchMode with three radio buttons in it. At a certain point, I want to see which...
4
by: Jared | last post by:
Radio Button or Check Box and Event Procedures I need to insert either radio buttons or check boxes onto my form. I'm not sure which to use, or if there are other options. I am using the buttons...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
7
by: nathaniel.k.lee | last post by:
Is it not possible, in IE, to dynamically click a radio button? I'm grabbing some values from a database and using them to populate radio buttons on a page. I have alternate code for Firefox...
3
by: teddysnips | last post by:
Back in the dim mists of antiquity I used to program in VBA for Microsoft Access (hey, don't knock it - very useful tool for the right application). This had a really handy control in the...
2
by: Laser Lips | last post by:
Hi All. This one has plagued me for a while. I want to get the value of the selected radio button in 2 ways. Bearing in mind that the radio buttons are always in a form tag. 1) I want to be...
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.