Why do you need to use .NET 8.0 for Windows Forms app? I suggest that you use .NET Framework 4.8 which will be supported probably longer than .NET 8.0.
If for some reason use of .NET 8.0 is must, you will be able to create Windows Forms app as described below although it is not practical in my opinion.
Even in the .NET 8.0 Windows Forms app project you will be able to create a strongly-typed DataSet / DataTable and TableAdapter.
Add new item, DataSet:
xsd file will be created:
Add the following Nuget packages and build the project:
After the above, you will have to do everything which is usually done by the Data Source Configuration Wizard in the .NET Framework project by yourself.
Copy the png images used in the BindingNavigator form the existing .NET Framework Windows Forms app to the Form1.resx:
Write code as shown in the following sample (only sample):
namespace WinFormsApp2
{
public partial class Form1 : Form
{
private NorthwindDataSet northwindDataSet;
private System.Windows.Forms.BindingSource productsBindingSource;
private NorthwindDataSetTableAdapters.ProductsTableAdapter productsTableAdapter;
private NorthwindDataSetTableAdapters.TableAdapterManager tableAdapterManager;
private System.Windows.Forms.BindingNavigator productsBindingNavigator;
private System.Windows.Forms.ToolStripButton bindingNavigatorAddNewItem;
private System.Windows.Forms.ToolStripLabel bindingNavigatorCountItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorDeleteItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveFirstItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMovePreviousItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator;
private System.Windows.Forms.ToolStripTextBox bindingNavigatorPositionItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator1;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveNextItem;
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2;
private System.Windows.Forms.ToolStripButton productsBindingNavigatorSaveItem;
private System.Windows.Forms.DataGridView productsDataGridView;
public Form1()
{
InitializeComponent();
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.northwindDataSet = new NorthwindDataSet();
this.productsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.productsTableAdapter = new NorthwindDataSetTableAdapters.ProductsTableAdapter();
this.tableAdapterManager = new NorthwindDataSetTableAdapters.TableAdapterManager();
this.productsBindingNavigator = new System.Windows.Forms.BindingNavigator(this.components);
this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel();
this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMovePreviousItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorSeparator = new System.Windows.Forms.ToolStripSeparator();
this.bindingNavigatorPositionItem = new System.Windows.Forms.ToolStripTextBox();
this.bindingNavigatorSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton();
this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.productsBindingNavigatorSaveItem = new System.Windows.Forms.ToolStripButton();
this.productsDataGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.northwindDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.productsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.productsBindingNavigator)).BeginInit();
this.productsBindingNavigator.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.productsDataGridView)).BeginInit();
this.SuspendLayout();
//
// northwindDataSet
//
this.northwindDataSet.DataSetName = "NorthwindDataSet";
this.northwindDataSet.SchemaSerializationMode =
System.Data.SchemaSerializationMode.IncludeSchema;
//
// productsBindingSource
//
this.productsBindingSource.DataMember = "Products";
this.productsBindingSource.DataSource = this.northwindDataSet;
//
// productsTableAdapter
//
this.productsTableAdapter.ClearBeforeFill = true;
//
// tableAdapterManager
//
this.tableAdapterManager.BackupDataSetBeforeUpdate = false;
this.tableAdapterManager.ProductsTableAdapter = this.productsTableAdapter;
this.tableAdapterManager.UpdateOrder =
NorthwindDataSetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete;
//
// productsBindingNavigator
//
this.productsBindingNavigator.AddNewItem = this.bindingNavigatorAddNewItem;
this.productsBindingNavigator.BindingSource = this.productsBindingSource;
this.productsBindingNavigator.CountItem = this.bindingNavigatorCountItem;
this.productsBindingNavigator.DeleteItem = this.bindingNavigatorDeleteItem;
this.productsBindingNavigator.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.bindingNavigatorMoveFirstItem,
this.bindingNavigatorMovePreviousItem,
this.bindingNavigatorSeparator,
this.bindingNavigatorPositionItem,
this.bindingNavigatorCountItem,
this.bindingNavigatorSeparator1,
this.bindingNavigatorMoveNextItem,
this.bindingNavigatorMoveLastItem,
this.bindingNavigatorSeparator2,
this.bindingNavigatorAddNewItem,
this.bindingNavigatorDeleteItem,
this.productsBindingNavigatorSaveItem});
this.productsBindingNavigator.Location = new System.Drawing.Point(0, 0);
this.productsBindingNavigator.MoveFirstItem = this.bindingNavigatorMoveFirstItem;
this.productsBindingNavigator.MoveLastItem = this.bindingNavigatorMoveLastItem;
this.productsBindingNavigator.MoveNextItem = this.bindingNavigatorMoveNextItem;
this.productsBindingNavigator.MovePreviousItem = this.bindingNavigatorMovePreviousItem;
this.productsBindingNavigator.Name = "productsBindingNavigator";
this.productsBindingNavigator.PositionItem = this.bindingNavigatorPositionItem;
this.productsBindingNavigator.Size = new System.Drawing.Size(1136, 25);
this.productsBindingNavigator.TabIndex = 0;
this.productsBindingNavigator.Text = "bindingNavigator1";
//
// bindingNavigatorAddNewItem
//
#nullable disable
this.bindingNavigatorAddNewItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorAddNewItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorAddNewItem.Image")));
this.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem";
this.bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorAddNewItem.Text = "新規追加";
//
// bindingNavigatorCountItem
//
this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
this.bindingNavigatorCountItem.Size = new System.Drawing.Size(29, 22);
this.bindingNavigatorCountItem.Text = "/ {0}";
this.bindingNavigatorCountItem.ToolTipText = "項目の総数";
//
// bindingNavigatorDeleteItem
//
this.bindingNavigatorDeleteItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorDeleteItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorDeleteItem.Image")));
this.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem";
this.bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorDeleteItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorDeleteItem.Text = "削除";
//
// bindingNavigatorMoveFirstItem
//
this.bindingNavigatorMoveFirstItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveFirstItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveFirstItem.Image")));
this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveFirstItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveFirstItem.Text = "最初に移動";
//
// bindingNavigatorMovePreviousItem
//
this.bindingNavigatorMovePreviousItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMovePreviousItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorMovePreviousItem.Image")));
this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMovePreviousItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMovePreviousItem.Text = "前に戻る";
//
// bindingNavigatorSeparator
//
this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
this.bindingNavigatorSeparator.Size = new System.Drawing.Size(6, 25);
//
// bindingNavigatorPositionItem
//
this.bindingNavigatorPositionItem.AccessibleName = "位置";
this.bindingNavigatorPositionItem.AutoSize = false;
this.bindingNavigatorPositionItem.Font = new System.Drawing.Font("Yu Gothic UI", 9F);
this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 23);
this.bindingNavigatorPositionItem.Text = "0";
this.bindingNavigatorPositionItem.ToolTipText = "現在の場所";
//
// bindingNavigatorSeparator1
//
this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1";
this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 25);
//
// bindingNavigatorMoveNextItem
//
this.bindingNavigatorMoveNextItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveNextItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveNextItem.Image")));
this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveNextItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveNextItem.Text = "次に移動";
//
// bindingNavigatorMoveLastItem
//
this.bindingNavigatorMoveLastItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.bindingNavigatorMoveLastItem.Image =
((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveLastItem.Image")));
this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true;
this.bindingNavigatorMoveLastItem.Size = new System.Drawing.Size(23, 22);
this.bindingNavigatorMoveLastItem.Text = "最後に移動";
//
// bindingNavigatorSeparator2
//
this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25);
//
// productsBindingNavigatorSaveItem
//
this.productsBindingNavigatorSaveItem.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.productsBindingNavigatorSaveItem.Image =
((System.Drawing.Image)(resources.GetObject("productsBindingNavigatorSaveItem.Image")));
this.productsBindingNavigatorSaveItem.Name = "productsBindingNavigatorSaveItem";
this.productsBindingNavigatorSaveItem.Size = new System.Drawing.Size(23, 22);
this.productsBindingNavigatorSaveItem.Text = "データの保存";
this.productsBindingNavigatorSaveItem.Click += ProductsBindingNavigatorSaveItem_Click;
#nullable enable
//
// productsDataGridView
//
//this.productsDataGridView.AutoGenerateColumns = false;
this.productsDataGridView.ColumnHeadersHeightSizeMode =
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.productsDataGridView.DataSource = this.productsBindingSource;
this.productsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.productsDataGridView.Location = new System.Drawing.Point(0, 25);
this.productsDataGridView.Name = "productsDataGridView";
this.productsDataGridView.RowTemplate.Height = 21;
//this.productsDataGridView.Size = new System.Drawing.Size(1136, 643);
this.productsDataGridView.TabIndex = 1;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.Controls.Add(this.productsDataGridView);
this.Controls.Add(this.productsBindingNavigator);
this.Name = "Form1";
this.Text = "Northwind";
this.Load += Form1_Load;
((System.ComponentModel.ISupportInitialize)(this.northwindDataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.productsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.productsBindingNavigator)).EndInit();
this.productsBindingNavigator.ResumeLayout(false);
this.productsBindingNavigator.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.productsDataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private void Form1_Load(object? sender, EventArgs e)
{
this.productsTableAdapter.Fill(this.northwindDataSet.Products);
}
private void ProductsBindingNavigatorSaveItem_Click(object? sender, EventArgs e)
{
this.Validate();
this.productsBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.northwindDataSet);
}
}
}
Result is: