Комментарии:
ياريت بعد ازنك فيديو شرح ازاي نعمل اتصال بقاعدة بيانات دينامك عن طريق فورم
ОтветитьWhen you close and open the program, all the data in the listview removes... how to keep them as you saved at once? Thanks
Ответитьhow to insert and update data in just one button(save) in C# // I need some help
Ответитьhow to fix 'could not copy obg debug to bin' error?
Ответить.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();
}
}
}
Thanks 😊
ОтветитьCódigo muito bem explicado, parabéns!
ОтветитьAwesome video!!!! Thank you!!!!!😍
ОтветитьThk u. Your lesson is helpful.
Ответить