add items in listbox |
ListBox us in visual basic c#(sharp) kis tarha hum listbox ko use karte hain visual basic me yeh me apko batuonga is post ke zariye so dosto apne listbox ko use karne me apko koi rocket sciecnce ki zaroorat nhi hai yeh bohat basic option hai visual basic me listbox ka use karna bohat asan hai but aj me btaouga ke hum items ko kis tarha move karwate hain move items to listbox 1 in to listbox 2 listbox me hum koi bhi items add kar sakte hai or phr usko jese chahe use me la skte hai but mene ek win form me 2 listBox liye hai 1st ListBox me kuch Items add karwa dia hai or 2 Listbox me wo items move karwane hai kis tarha hum items move kar skte hai 1st listBox se 2nd ListBox me
or Hum 4 buttons ka use karege jese
1st buttons move ke liye
2nd button returns move ke liye
3rd button all items move ke lye
4th button all items return move ke liye
to dosto yeh bohot asan hai create karna jesey ke apne pic me dekh skete ho
move items in listBox |
yeh is form ki coding hai agar ap is hi tarha ka form create karna chahte hai to is coding ki help se create karskte ho yeh source code is hi form ka hai ap chahe to is jesa hi form create karle
ok friends if you like this post so share now with your friends and here is my youtube channel
https://www.youtube.com/babarahsan
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex == -1)
{
MessageBox.Show("Please Select an Items");
}
else
{
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.Remove(listBox1.SelectedItem);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (listBox2.SelectedIndex == -1)
{
MessageBox.Show("Please Select an Items");
}
else
{
listBox1.Items.Add(listBox2.SelectedItem);
listBox2.Items.Remove(listBox2.SelectedItem);
}
}
private void button5_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex == -1)
{
MessageBox.Show("Please Select an Items");
}
else
{
while (listBox1.SelectedItems.Count != 0)
{
listBox2.Items.Add(listBox1.SelectedItems[0]);
listBox1.Items.Remove(listBox1.SelectedItems[0]);
}
}
}
private void button4_Click(object sender, EventArgs e)
{
if (listBox2.SelectedIndex == -1)
{
MessageBox.Show("Please Select an Items");
}
else
{
while (listBox2.SelectedItems.Count != 0)
{
listBox1.Items.Add(listBox2.SelectedItem);
listBox2.Items.Remove(listBox2.SelectedItem);
}
}
} }
}
0 komentar:
Post a Comment