C# tutorial for beginners_ insert, update and delete data in listView without using database

C# tutorial for beginners_ insert, update and delete data in listView without using database

Programming for Everybody

2 года назад

26,687 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@fathyahmed3448
@fathyahmed3448 - 24.07.2022 19:32

ياريت بعد ازنك فيديو شرح ازاي نعمل اتصال بقاعدة بيانات دينامك عن طريق فورم

Ответить
@Sessizgemi852011
@Sessizgemi852011 - 03.01.2023 23:21

When you close and open the program, all the data in the listview removes... how to keep them as you saved at once? Thanks

Ответить
@abdulqahar9852
@abdulqahar9852 - 31.05.2023 00:35

how to insert and update data in just one button(save) in C# // I need some help

Ответить
@ananthepan2424
@ananthepan2424 - 04.10.2023 15:01

how to fix 'could not copy obg debug to bin' error?

Ответить
@kvelez
@kvelez - 03.05.2024 02:23

.NET8 Windows Forms Core:

namespace WinFormsList
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
TableList.Columns.Add("Id", 80);
TableList.Columns.Add("FirstName", 120);
TableList.Columns.Add("LastName", 120);
TableList.Columns.Add("Points", 100);
}

private void AddButton_Click(object sender, EventArgs e)
{
var newItem = new ListViewItem(Id.Text);
newItem.SubItems.Add(FirstName.Text);
newItem.SubItems.Add(LastName.Text);
newItem.SubItems.Add(Points.Text);
TableList.Items.Add(newItem);
}

private void NewButton_Click(object sender, EventArgs e)
{
Id.Text = string.Empty;
FirstName.Text = string.Empty;
LastName.Text = string.Empty;
Points.Text = string.Empty;
}

private void TableList_Click(object sender, EventArgs e)
{
// AJAX-like Selection
if (TableList.SelectedItems.Count > 0)
{
Id.Text = TableList.SelectedItems[0].SubItems[0].Text;
FirstName.Text = TableList.SelectedItems[0].SubItems[1].Text;
LastName.Text = TableList.SelectedItems[0].SubItems[2].Text;
Points.Text = TableList.SelectedItems[0].SubItems[3].Text;
}
}

private void UpdateButton_Click(object sender, EventArgs e)
{
if (TableList.SelectedItems.Count > 0)
{
TableList.SelectedItems[0].SubItems[0].Text = Id.Text;
TableList.SelectedItems[0].SubItems[1].Text = FirstName.Text;
TableList.SelectedItems[0].SubItems[2].Text = LastName.Text;
TableList.SelectedItems[0].SubItems[3].Text = Points.Text;
}
}

private void RemoveButton_Click(object sender, EventArgs e)
{
if (TableList.SelectedItems.Count > 0)
{
TableList.Items.Remove(TableList.SelectedItems[0]);
}
}

private void RemoveAllButton_Click(object sender, EventArgs e)
{
TableList.Items.Clear();
}
}
}

Ответить
@jayshrikhamk97
@jayshrikhamk97 - 09.05.2024 08:08

Thanks 😊

Ответить
@jocimarsilva9425
@jocimarsilva9425 - 18.05.2024 12:42

Código muito bem explicado, parabéns!

Ответить
@ЙорданкаКемчева
@ЙорданкаКемчева - 28.05.2024 12:42

Awesome video!!!! Thank you!!!!!😍

Ответить
@PhongLan315
@PhongLan315 - 25.04.2023 07:20

Thk u. Your lesson is helpful.

Ответить