listbox

V

Vishruth Ranjit

Hi,
I wish someone should be kind enough to help me in
answering this for me

1. Suppose we have two listboxes then if we want to
retrieve all the contents from listbox1 to listbox2
say 10 elements what is to be done.
2. How do u connect VB.net to MS ACCESS

Thanking you.
 
A

Ayende Rahien

Vishruth Ranjit said:
Hi,
I wish someone should be kind enough to help me in
answering this for me

1. Suppose we have two listboxes then if we want to
retrieve all the contents from listbox1 to listbox2
say 10 elements what is to be done.

You want to move ten items from listbox1 to 2?
do this (not elegant, but works
int i =0;
foreach(ListItem li in listbox1.Items)
{
if(i==10)break;
listbox2.Items.Add(li);
}
That would copy at most 10 elements (less if there aren't that many)
2. How do u connect VB.net to MS ACCESS

You need to look into System.Data;
But basically you do something like:

OleDbConnection con = new OleDbConnection("Connection string");
con.Open();
 
H

Herfried K. Wagner [MVP]

* "Vishruth Ranjit said:
I wish someone should be kind enough to help me in
answering this for me

1. Suppose we have two listboxes then if we want to
retrieve all the contents from listbox1 to listbox2
say 10 elements what is to be done.

\\\
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Me.ListBox2.Items.AddRange(Me.ListBox1.Items)
Me.ListBox1.Items.Clear()
End Sub

Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.DoubleClick
Me.ListBox1.Items.AddRange(Me.ListBox2.Items)
Me.ListBox2.Items.Clear()
End Sub
///
2. How do u connect VB.net to MS ACCESS

<http://www.connectionstrings.com>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top