C#? ?? ??
Sep 03, 2024 pm 03:28 PMC#? ListBox? ?? ?? ?? ??? ?? ???? ?? ListBox? ?? ??? ???? ??? ?????. ???? ??? ?? ??? ???? ???? ??? ? ?? ??? ??? ??? ? ??? ?? ??? ?? ? ?? ?? ?? ?? ??? ??? ? ??? ????. ListBox? ??? ??? ???, ?? ? ???? ?????. ? ListBox? ??? ??? ?????. Windows.Forms ???(??????).
ListBox ????? C#? 3?? ?? ??? ??? ???? ????. ???
- ?ListBox.ObjectCollection:?? ??? ???? ListBox ???? ?? ??? ???????.
- ?ListBox.SelectedObjectCollection:?? ??? ???? ListBox ????? ??? ??? ???? ?????.
- ?ListBox.SelectedIndexCollection:?? ??? ???? ??? ??? ???? ?????. ??? ??? ListBox.ObjectCollection ???? ?? ???? ListBox ????? ??? ??? ??????.
C#? ?? ?? ??? ??????
- ?? ?? ListBox: ListBox? ???? ?? ??? ??? ? ????.
- ?? ?? ListBox: ListBox? ???? ?? ??? ??? ? ????.
C#? ListBox ?? ?? ??:
- PC? .Net ?????? ???? ??? ???
- Visual Studio ??
C#?? ListBox? ??? ??? ??????
ListBox? ? ?? ???? ?? ? ????.
- ?????
- ???
1. ?????
???? ?? ??? ?? ?? ?? ? ????. ???? ?? ??
1??: Visual Studio ??
??=>?? ???=>????? ?????
=>Windows Form ?? ????? ??? ??
???? ??? ? ? ????? ?? ???? ?????.
???? ??? ???? OK? ??? ??? ?? Form1.cs(Design) ?? ????
2??: Visual Studio ?? ?? ???? ?? ??? ?????. ?? ?? ? ???? ?? ??? ??? Form1.cs(Design)? ??? ????.
3??: ??? ?? ? Visual Studio ????? ??? ???? Text ??? ??? ?????. ? ??nd ??? ????? ??? ???? ? ?????.
??:
2. ???
? ???? ?? ?? ?? ????. ??? ListBox? ???? ?? ? ?? ????? ??????. ??? ?? ?????. ?? ListBox, Label, TextField, Button ?? ?? ?? ?? ??? ??? ????. ?? ?? ? ??? ? ? ???? ?? ???? ??? ?? C# ??? ?????. ? ???? ??? ??? ????. ListBox? ???? ?? ??? ???? ??? ???? ??
1??: ListBox() ???? ???? ListBox ???? ????.
??:
ListBox listBox = new ListBox();
2??: ListBox ??? ??? ? Font, Font.Size, Color ? ListBox? ??? ??? ????? ??
??:
listBox.Location = new Point(200, 100); listBox.Size = new Size(100, 90); listBox.ForeColor = Color.Red;
3??: ListBox? ??? ?????.
??:
listBox.Items.Add("A"); listBox.Items.Add("B"); listBox.Items.Add("C"); listBox.Items.Add("D");
4??: ??? ? ListBox? ?????.
??:
this.Controls.Add(listBox);
C#? ?? ?? ?
??? ??? ??? ??? ????
?? #1 – ListBox ?? ? ?? ??
??:
//importing C# required libraries using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; //namespace is project name namespace WindowsFormsApplication26 { //creating class extends from Form class public partial class Form1 : Form { //constrcutor public Form1() { //initializing components InitializeComponent(); //Creating list box and add some properties and values to the List Box listBox2.ForeColor = Color.Red; listBox2.Items.Add("Java"); listBox2.Items.Add("Python"); listBox2.Items.Add("C++"); listBox2.Items.Add("C"); listBox2.Items.Add("C#"); listBox2.Items.Add("Spring"); listBox2.Items.Add("JavaFX"); listBox2.SelectionMode = SelectionMode.MultiSimple; } //method for selectedIndex change operation private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { } } }
??:
?? #2 – ???? ??? ???? ?? ??? ??? ?? ?????
??:
//importing C# required libraries using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; //namespace is project name namespace WindowsFormsApp25 { //creating class extends from Form class public partial class Form1 : Form { //constrcutor public Form1() { //initializing components InitializeComponent(); } //saving the enter values into List box private void buttonSave_Click(object sender, EventArgs e) { //If user enter any values then if block executes if (this.textBoxName.Text != "") { NameList.Items.Add(this.textBoxName.Text); this.textBoxName.Focus(); this.textBoxName.Clear(); } //If user did not enter any values then else block executes else { MessageBox.Show("Please enter a name to add..","Error",MessageBoxButtons.OK,MessageBoxIcon.Information); this.textBoxName.Focus(); } } } }
??:
?? ???? ?:
?? ?? ???? ?? ?? ??? ?????.
?? ??? ?:
After entering a value and clicking the save button:
Example #3 – Delete, Change the font of List Box values
Code:
//importing C# required libraries using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; //namespace is project name namespace WindowsFormsApp25 { //creating class extends from Form class public partial class Form1 : Form { //constrcutor public Form1() { //initializing components InitializeComponent(); } //saving the enter values into List box private void buttonSave_Click(object sender, EventArgs e) { //If user enter any values then if block executes if (this.textBoxName.Text != "") { NameList.Items.Add(this.textBoxName.Text); this.textBoxName.Focus(); this.textBoxName.Clear(); } //If user did not enter any values then else block executes else { MessageBox.Show("Please enter a name to add..","Error",MessageBoxButtons.OK,MessageBoxIcon.Information); this.textBoxName.Focus(); } } //Removing the selected elements private void button2_Click(object sender, EventArgs e) { if (this.NameList.SelectedIndex >= 0) { this.NameList.Items.RemoveAt(this.NameList.SelectedIndex); } } //Setting List box selected values font private void button3_Click(object sender, EventArgs e) { if (fontDialog1.ShowDialog() == DialogResult.OK) { NameList.Font = fontDialog1.Font; } } } }
Output:
After adding 3 names:
Deleting selected element:
Change the font of the values:
Conclusion
C# List box is used to add multiple elements to perform any specific operation. List Boxes are used to select a single value or multiple values at a time. In C# List Box can be created using Design-Time and Run-Time methods.
? ??? C#? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

?? ???? ????? ???? ?? ???? ??? ?? ???? ???? ??, ?? ???? ???? ?? ?????? ??? ????? ????. ?? ???? ??? ??? ? ??? ???? ????? ??? ?? ??? ?????. ?? ???? ??? ??? ??? ????? ???? ???? ??? UI ???? ???? ?? ????. ?? ??? ?? ????? ???? ?? ??? ??? ?? ????. ?? ??? ??? ?? ???? ???? ?? ???? ?? ???? UI ?? ?? ?????? ?? ???? ??? ?????.

C#? C? ??? ??? ???? ??? ??? ????. 1.C? 1983 ? Bjarnestroustrup? ?? ???? ?? ?? ?????? C ??? ??????. Evolution ?????? ?? ??? ?? ? Lambda Expressions ?? C 11, C 20 ?? ?? ? ? ??? ?? ?? ???? ???? ?? ?? ? ??? ?? ?????? ??? ? ????. 2.C#? 2000 ? Microsoft? ?? ?????? C? Java? ??? ???? ??? ???? ???? ??? ???. ?? ??, C#2.0? ???? C#5.0 ?? ? ??? ?????? ?????, ?? ?? ???? ??? ? ???? ???? ??? ? ????.

XML? JSON?? ???? ??? ??? ????. ????? ?? (Python, Java, C#)? ???? ?? ???? ?? ??; ??? ?? (? : XML?? JSON, Gojko? XML ???, XML ??? ??)? ???? XML ???? ?? ??? ????? JSON ?? ?? ??; XML?? JSON ???? ???? ?? ?? ?? (? : ?? XML ???, Stylus Studio, Altova XMLSPy); XSLT ??? ??? ???? XML? JSON?? ????; ??? ?? ???? (? : Informatic) ??

C# ?? ??? ?????? ????? ?? ??? ??? ?? ? ??? ?????. ??? ????? ?? ?? ????? ?? ??? ?????? ???? ???? ???? ? ????. ??? ???? ???? ?? ???? ??? ????? ?? ? Async/Await? ?? ?? ????? ??? ??? ?? ? ??? ?? ??? ?? ? ? ????. ?? ??? ?????? ???? ???? ?? ??, ??? ?? ? ?? ??? ????, ??? ??? ??? ??? ??? ??? ??? ?? ??? ??? ????? ???????.

.NET? ???? ?? ????? ???? ??? .NET? ???? ?? ???? ?? ?? ????? ?? ??? ?? ?? ? ? ????. 1) C# ?? ? ??? ??? ?? ??? ??? .NET? ?? ??? ?????. 2) .NET ???? ?? ?? ? ?? ??? ?? ?? ??? ?????. 3) ??? ?? ???????? ??? WebApis ? ?????? ??? ????? ?? ? ?? ??? ??????. 4) ?? ? ?????? ?? ??? ?? ???? ?? ? ??? ??? ???????. 5) ?? ???? ?? ??? ? ??? ????? ? ??? ?? ?? ??.

C#.NETISVERSATILEFORBOTHWEBBANDDESKTOPDEVENTROMMENT.1) FORWEB, useASP.NETFORRICHINTERFACES.3) FORDESKTOP.3) USEXAMARINFORCROSS-PLATFORMDEEVENTRIMMENT, LINABILEDEV, MACODEDEV, and MACODEDOWS, ? MACODEDOWS.

?? ???? ??? ?? ?? ?? ???? ????? ??? ?? ??? ??? ???? ?? ?? ? ??? ???? ???? ? ??? ????. ?? ?? ?? ??? ??? ???? ???? ???? ? ????. ??? ?? ?? ???? ?? ??? ??? ? ???? CPU ?? ?? ?? ??? ?? ??? ?? ???? ???????. ?? ?? ??? ??????? ?? ?? ? ??? ??? ?? ??? ???? ??? ????? ???? ?????? ?? ?????? ?? ??? ??, ???? ???????? ???????.

.NETFramework? ????? ??? ???? C#? ????? ?????. 1..netframework? ????, ? ? ??? ?????? ??? ???? ????? ? ???? ?????. 2.C#? .NETFramework ??? ?????? ?? ????? ??? ?????. 3..NetFramework? CLR? ?? ?? ??? ???? C# ??? IL? ????? CLR? ?? ?????. 4. .NETFramework? ???? ?? ????? ???? ???? C#? LINQ? ?? ?? ??? ?????. 5. ???? ???? ?? ?? ? ??? ????? ?? ??? ?????. ???? ???? VisualStudio ??? ?????.
