VB.Net Products Manager Project With MySQL Database

How To Make a VB.Net Products Manager Project With MySQL Database Using Visual Studio

VB.Net Products Manager Project With MySQL Database


in this visual basic .net tutorial we will see how to Create a products manager project in one form using windowForm in vb.net programming language and mysql database.

tools:
- visual basic .net programming language.
- microsoft visual studio express 2013.
- mysql database.
- phpmyadmin.
- pixabay.com.

Watch The Full Tutorial



- The Project Source Code


Imports MySql.Data.MySqlClient


Public Class ManagementForm

    ' variables
    Dim connection As MySqlConnection = New MySqlConnection("datasource = localhost;port = 3306; initial catalog = csharp_products; username = root; password =")
    Dim table As DataTable = New DataTable()
    Dim productIndex As Integer = 0



    ' form load
    Private Sub ManagementForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load

         ' custom datagridview
        dataGridViewProducts.RowTemplate.Height = 40
        pictureBoxClose.Image = My.Resources.close
        ' populate datagridview
        showProducts()
        comboBoxCategories.SelectedIndex = 0
        dataGridViewProducts.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(47, 54, 64)
        dataGridViewProducts.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
        dataGridViewProducts.ColumnHeadersDefaultCellStyle.Font = New System.Drawing.Font("Verdana", 15, FontStyle.Italic)
        dataGridViewProducts.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        dataGridViewProducts.GridColor = Color.DarkBlue
        dataGridViewProducts.AllowUserToAddRows = False
        dataGridViewProducts.EnableHeadersVisualStyles = False

    End Sub

    picturebox close
    Private Sub pictureBoxClose_Click(sender As Object, e As EventArgs) Handles pictureBoxClose.Click

        close the connection
        If ConnectionState.Open = connection.State Then
            connection.Close()
        End If

        System.Environment.[Exit](System.Environment.ExitCode)

    End Sub

    button search
    Private Sub buttonSearch_Click(sender As Object, e As EventArgs) Handles buttonSearch.Click

        Try
            Dim id As Integer = CInt(numericUpDownID.Value)
            Dim row As DataRow() = table.[Select]("id = " & id)

            If row.Length > 0 Then
                textBoxName.Text = row(0)(1).ToString()
                comboBoxCategories.Text = row(0)(2).ToString()
                NumericUpDownQuantity.Text = row(0)(3).ToString()
                textBoxPrice.Text = row(0)(4).ToString()
                textBoxImagePath.Text = row(0)(5).ToString()
                pictureBoxProduct.Image = Image.FromFile(row(0)(5).ToString())
            Else
                textBoxName.Text = ""
                comboBoxCategories.SelectedIndex = 0
                NumericUpDownQuantity.Text = ""
                textBoxPrice.Text = ""
                textBoxImagePath.Text = ""
                pictureBoxProduct.Image = Nothing
                MessageBox.Show("No Product With This ID, Enter a New One", "Product Not found", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If

        Catch ex As Exception
            MessageBox.Show("Error -> " & ex.Message, "Product Not found", MessageBoxButtons.OK, MessageBoxIcon.[Error])
        End Try

    End Sub

    button browse image
    Private Sub buttonBrowse_Click(sender As Object, e As EventArgs) Handles buttonBrowse.Click

        Dim opf As OpenFileDialog = New OpenFileDialog()
        opf.Filter = "Choose Image(*.jpg;*.png;*.gif)|*.jpg;*.png;*.gif"

        If opf.ShowDialog() = DialogResult.OK Then
            pictureBoxProduct.Image = Image.FromFile(opf.FileName)
            textBoxImagePath.Text = opf.FileName
        End If

    End Sub

    button add product
    Private Sub Button_Add_Click(sender As Object, e As EventArgs) Handles Button_Add.Click

        Try
            Dim name As String = textBoxName.Text
            Dim category As String = comboBoxCategories.Text
            Dim quantity As Integer = Integer.Parse(NumericUpDownQuantity.Text)
            Dim price As Single = Single.Parse(textBoxPrice.Text)
            Dim imagePath As String = textBoxImagePath.Text
            Dim command As MySqlCommand = New MySqlCommand("INSERT INTO `product`(`name`, `category`, `quantity`, `price`, `picture`) VALUES (@nm,@ctg,@qty,@prc,@pic)", connection)
            command.Parameters.Add("@nm", MySqlDbType.VarChar).Value = name
            command.Parameters.Add("@ctg", MySqlDbType.VarChar).Value = category
            command.Parameters.Add("@qty", MySqlDbType.Int16).Value = quantity
            command.Parameters.Add("@prc", MySqlDbType.Float).Value = price
            command.Parameters.Add("@pic", MySqlDbType.VarChar).Value = imagePath

            If ConnectionState.Closed = connection.State Then
                connection.Open()
            End If

            If command.ExecuteNonQuery() = 1 Then
                showProducts()
                MessageBox.Show("The Product Has Been Added Successfully", "Product Added", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("The Product Hasn't Been Added", "Product Not Added", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            End If

        Catch ex As Exception
            MessageBox.Show("Enter The Product Info", "Empty Fileds", MessageBoxButtons.OK, MessageBoxIcon.[Stop])
        End Try


    End Sub


    button edit product
    Private Sub Button_Edit_Click(sender As Object, e As EventArgs) Handles Button_Edit.Click

        Try
            Dim id As Integer = CInt(numericUpDownID.Value)
            Dim name As String = textBoxName.Text
            Dim category As String = comboBoxCategories.Text
            Dim quantity As Integer = Integer.Parse(NumericUpDownQuantity.Text)
            Dim price As Single = Single.Parse(textBoxPrice.Text)
            Dim imagePath As String = textBoxImagePath.Text
            Dim command As MySqlCommand = New MySqlCommand("UPDATE `product` SET `name`=@nm,`category`=@ctg,`quantity`=@qty,`price`=@prc,`picture`=@pic WHERE `id` = @id", connection)
            command.Parameters.Add("@nm", MySqlDbType.VarChar).Value = name
            command.Parameters.Add("@ctg", MySqlDbType.VarChar).Value = category
            command.Parameters.Add("@qty", MySqlDbType.Int16).Value = quantity
            command.Parameters.Add("@prc", MySqlDbType.Float).Value = price
            command.Parameters.Add("@pic", MySqlDbType.VarChar).Value = imagePath
            command.Parameters.Add("@id", MySqlDbType.Int16).Value = id

            If ConnectionState.Closed = connection.State Then
                connection.Open()
            End If

            If command.ExecuteNonQuery() = 1 Then
                showProducts()
                MessageBox.Show("The Product Info Has Been Edited Successfully", "Edit Product", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("The Product Info Hasn't Been Edited", "Product Not Edited", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            End If

        Catch ex As Exception
            MessageBox.Show("Enter The Product Info", "Empty Fileds", MessageBoxButtons.OK, MessageBoxIcon.[Stop])
        End Try

    End Sub

    button remove product
    Private Sub Button_Remove_Click(sender As Object, e As EventArgs) Handles Button_Remove.Click

        Dim id As Integer = CInt(numericUpDownID.Value)
        Dim command As MySqlCommand = New MySqlCommand("DELETE FROM `product` WHERE `id` = @id", connection)
        command.Parameters.Add("@id", MySqlDbType.Int16).Value = id

        If ConnectionState.Closed = connection.State Then
            connection.Open()
        End If

        If MessageBox.Show("Are You Sure You Want To Remove This Product", "Remove Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = System.Windows.Forms.DialogResult.Yes Then

            If command.ExecuteNonQuery() = 1 Then
                numericUpDownID.Value = 0
                textBoxName.Text = ""
                comboBoxCategories.SelectedIndex = 0
                NumericUpDownQuantity.Text = ""
                textBoxPrice.Text = ""
                textBoxImagePath.Text = ""
                pictureBoxProduct.Image = Nothing
                showProducts()
                MessageBox.Show("Product Removed Successfully", "Remove Product", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Product NOT Removed", "Remove Product", MessageBoxButtons.OK, MessageBoxIcon.[Error])
            End If
        End If


    End Sub


    button clear fields
    Private Sub buttonClear_Click(sender As Object, e As EventArgs) Handles buttonClear.Click

        textBoxName.Text = ""
        comboBoxCategories.SelectedIndex = 0
        NumericUpDownQuantity.Text = ""
        textBoxPrice.Text = ""
        textBoxImagePath.Text = ""
        pictureBoxProduct.Image = Nothing

    End Sub


    button display first product
    Private Sub buttonFirst_Click(sender As Object, e As EventArgs) Handles buttonFirst.Click

        productIndex = 0
        displayInfo(productIndex)

    End Sub


    button display next product
    Private Sub buttonNext_Click(sender As Object, e As EventArgs) Handles buttonNext.Click

        productIndex += 1

        If productIndex > table.Rows.Count - 1 Then
            productIndex = table.Rows.Count - 1
        End If

        displayInfo(productIndex)

    End Sub


    button display previous product
    Private Sub buttonPrevious_Click(sender As Object, e As EventArgs) Handles buttonPrevious.Click

        productIndex -= 1

        If productIndex < 0 Then
            productIndex = 0
        End If

        displayInfo(productIndex)

    End Sub


    button display last product
    Private Sub buttonLast_Click(sender As Object, e As EventArgs) Handles buttonLast.Click

        productIndex = table.Rows.Count - 1
        displayInfo(productIndex)

    End Sub

    display the selected product from datagridview
    Private Sub dataGridViewProducts_Click(sender As Object, e As EventArgs) Handles dataGridViewProducts.Click

        Dim selectedRow As DataGridViewRow = dataGridViewProducts.CurrentRow
        numericUpDownID.Value = Integer.Parse(selectedRow.Cells(0).Value.ToString())
        textBoxName.Text = selectedRow.Cells(1).Value.ToString()
        comboBoxCategories.Text = selectedRow.Cells(2).Value.ToString()
        NumericUpDownQuantity.Text = selectedRow.Cells(3).Value.ToString()
        textBoxPrice.Text = selectedRow.Cells(4).Value.ToString()
        textBoxImagePath.Text = selectedRow.Cells(5).Value.ToString()
        pictureBoxProduct.Image = Image.FromFile(selectedRow.Cells(5).Value.ToString())

    End Sub


   ' textBox Price KeyUp - check if the price is correct
    Private Sub textBoxPrice_KeyUp(sender As Object, e As KeyEventArgs) Handles textBoxPrice.KeyUp

        Try
            Dim price As Single = Single.Parse(textBoxPrice.Text)
        Catch ex As Exception
            MessageBox.Show("Enter a Valid Price ( " & ex.Message & " )", "Invalid Price", MessageBoxButtons.OK, MessageBoxIcon.[Error])
            textBoxPrice.Text = ""
        End Try

    End Sub


    create a function to display product in textboxes and picturebox
    Public Sub displayInfo(ByVal index As Integer)
        dataGridViewProducts.ClearSelection()
        dataGridViewProducts.Rows(index).Selected = True
        numericUpDownID.Value = CInt(table.Rows(index)(0))
        textBoxName.Text = table.Rows(index)(1).ToString()
        comboBoxCategories.Text = table.Rows(index)(2).ToString()
        NumericUpDownQuantity.Text = table.Rows(index)(3).ToString()
        textBoxPrice.Text = table.Rows(index)(4).ToString()
        textBoxImagePath.Text = table.Rows(index)(5).ToString()
        pictureBoxProduct.Image = Image.FromFile(table.Rows(index)(5).ToString())
    End Sub


    ' create a function to show products in the datagridview
    Public Sub showProducts()
        table.Clear()
        dataGridViewProducts.DataSource = table
        Dim adapter As MySqlDataAdapter = New MySqlDataAdapter("SELECT * FROM `product`", connection)
        adapter.Fill(table)
        dataGridViewProducts.DataSource = table
        label_ProductsCount.Text = table.Rows.Count.ToString() & " Product"
    End Sub


End Class


OUTPUT:

VB.Net Project Source Code With MySQL Database

VB.Net Project Source Code With MySQL Database


VB.NET Guess The Word Game Source Code

How To Make Guess The Word Game In VB.Net

VB.NET Guess The Word Game


in this visual basic .net tutorial we will see how to build a Guess The Word Game using vb.net programming language .


Watch The Full Tutorial



- The Project Source Code


Public Class Form1

    Dim words() As String = {"potato", "tomato", "computer", "appartment", "forest", "chocolat", "lawyer"}
    Dim item As Integer = 0
    Dim random As Random = New Random()
    Dim score As Integer = 0

    ' button start
    Private Sub Btn_Start_Click(sender As Object, e As EventArgs) Handles Btn_Start.Click

        item = 0

        TextBox1.Text = ""
        Label_Result.Text = ""
        score = 0

        displayWord()

        Btn_Next.Enabled = True

        Btn_Start.Enabled = False


    End Sub


    ' button display the next word
    Private Sub Btn_Next_Click(sender As Object, e As EventArgs) Handles Btn_Next.Click

            checkWord()

        If item < words.Length - 1 Then

            item += 1
            displayWord()


        End If




    End Sub


    ' create a function to display the word
    Public Sub displayWord()

            Dim pos1 As Integer = System.Convert.ToInt32(((random.Next((words(item).Length)))))
            Dim pos2 As Integer = System.Convert.ToInt32(((random.Next((words(item).Length)))))
            Dim pos3 As Integer = System.Convert.ToInt32(((random.Next((words(item).Length)))))

            Dim word As String = words(item)
            Dim wee As String = ""

            word = word.Remove(pos1, 1).Insert(pos1, "_")
            word = word.Remove(pos2, 1).Insert(pos2, "_")
            word = word.Remove(pos3, 1).Insert(pos3, "_")

            Label_Word.Text = word

        
    End Sub

 
    create a function to check if the player entred the correct word
    Public Sub checkWord()
        If words(item).Equals(TextBox1.Text) Then
            Label_Result.Text = "Correct"
            Label_Result.BackColor = Color.Green
            score += 1
        Else
            Label_Result.Text = "Wrong"
            Label_Result.BackColor = Color.Red
        End If


        If item = words.Length - 1 Then

            Label_Result.Text += " ( " & score & " / " & words.Length & " )"
            Label_Result.BackColor = Color.DarkViolet

            Btn_Start.Enabled = True

        End If

        TextBox1.Text = ""

    End Sub



End Class



OUTPUT:

Guess The Word Game In VB.Net

Guess The Word Game Using VB.Net

Guess The Word Game Source Code Using VB.Net

Guess The Word Game Source Code In VB.Net

VB.Net Guess The Word Game Source Code


C# Create Menu Using MySQL

How To Make A Menu Using MenuStrip And  MySQL Database In C#

Create Menu Using MySQL Database In C#

In This C# Tutorial  We Will See How To Create A Menu Using MenuStrip And Add To This Menu Categories Using ToolStripMenuItem With Image And Text From MySQL Database Table And Add Also To This ToolStripMenuItem SubCategorys Elements From MySQL Database Using MySqlDataAdapter + DataTable + MemoryStream In Csharp Programming Language And Visual Studio Editor.


Project Source Code:

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;
using MySql.Data.MySqlClient;
using System.IO;

namespace Csharp_Tutorials
{
    public partial class Create_Menu_From_MySQL : Form
    {
        public Create_Menu_From_MySQL()
        {
            InitializeComponent();
        }

        MySqlConnection connection = new MySqlConnection("datasource=localhost;port=3306;Initial Catalog='mydb';username=root;password=");
       
        private void Create_Menu_From_MySQL_Load(object sender, EventArgs e)
        {

            // add ToolStripMenuItem elements to menustrip using for loop
            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM mypics", connection);
            DataTable table = new DataTable();

            adapter.Fill(table);

            for (int i = 0; i < table.Rows.Count; i++)
            {

                /*
                 * table => mypics
                 * table.Rows[i][3] = image column
                 * table.Rows[i][1] = name column
                 * table.Rows[i][1] = id column
                 */

                byte[] img = (byte[])table.Rows[i][3];
                MemoryStream ms = new MemoryStream(img);

                Image pic = Image.FromStream(ms);

                ToolStripMenuItem mit = new ToolStripMenuItem(table.Rows[i][1].ToString(), pic);

                addItems(mit, table.Rows[i][0].ToString());

                menuStrip1.Items.Add(mit);

            }

        }


        // create a function to add subElements to ToolStripMenuItem 
        public void addItems(ToolStripMenuItem MenuItem, string id)
        {

            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT idMyPics, name, pic FROM pics2 WHERE idMyPics = " + id, connection);
            DataTable table = new DataTable();

            adapter.Fill(table);

            for (int i = 0; i < table.Rows.Count; i++)
            {

                /*
                 * table => pics2
                 * table.Rows[i][2] = image column
                 * table.Rows[i][1] = name column
                 */

                byte[] img = (byte[])table.Rows[i][2];
                MemoryStream ms = new MemoryStream(img);

                Image pic = Image.FromStream(ms);

                MenuItem.DropDown.Items.Add(table.Rows[i][1].ToString(), pic);
            }

        }
    }
}

      

///////////////OUTPUT:

Make a Menu From Database In C#




C# Add Item To Menu From MySQL

How To Add A New Item To MenuStrip From MySQL Database In C#

Add Item To MenuStrip From MySQL In C#

In This C# Tutorial  We Will See How To Create A New ToolStripMenuItem With Image And Text From MySQL Database Table And Add This ToolStripMenuItem To A MenuStrip Element Using MySqlDataAdapter + DataTable + MemoryStream In Csharp  Programming Language And Visual Studio Editor.


Project Source Code:

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;
using MySql.Data.MySqlClient;
using System.IO;

namespace Csharp_Tutorials
{
    public partial class Add_Item_To_MenuStrip_From_MySQL : Form
    {
        public Add_Item_To_MenuStrip_From_MySQL()
        {
            InitializeComponent();
        }

// create a connection with the database
        MySqlConnection connection = new MySqlConnection("datasource=localhost;port=3306;Initial Catalog='mydb';username=root;password=");
        
        private void Add_Item_To_MenuStrip_From_MySQL_Load(object sender, EventArgs e)
        {
            MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM mypics", connection);
            DataTable table = new DataTable();

            adapter.Fill(table);

            for (int i = 0; i < table.Rows.Count; i++)
            {
// get the image from the database
                byte[] img = (byte[])table.Rows[i][3];
                MemoryStream ms = new MemoryStream(img);

                Image pic = Image.FromStream(ms);

// create a new toolstripmenuitem with text and image
                ToolStripMenuItem mitem = new ToolStripMenuItem(table.Rows[i][1].ToString(), pic);

// add our toolstripmenuitem to the menustrip
                menuStrip1.Items.Add(mitem);
            }
        }
    }
}

      

///////////////OUTPUT:

Add Item To MenuStrip From Database Using C#





VB.NET - Create Glass Bridge Game

How To Make The Glass Bridge Game From Squid Game In Visual Basic .Net

VB.NET Glass Bridge Game


In this VB.NET Tutorial we will see How To Make The Glass Stepping Stones Game or the glass bridge game From Squid Game Using Panels and PictureBoxes In Visual Basic.Net   Programming Language And Visual  Studio Editor.

The Game Rules:
the player have to hop across a bridge of glasses with some glasses that breack easily.



Project Source Code:


Public Class Game_Form

    Dim footstep As Bitmap = My.Resources.footstep
    Dim nostep As Bitmap = My.Resources.nostep
    Dim random As Random = New Random()
    Dim randomImage As Bitmap
    Dim picBoxes As PictureBox(,)
    Dim imagesOrder As Bitmap(,) = New Bitmap(5, 1) {}
    Dim list As ArrayList = New ArrayList()
    Dim counter As Integer = 0
    Dim won As Boolean = True

    Private Sub Game_Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        pictureBoxStart.Image = footstep

        ' array of picturboxes
        picBoxes = {
        {pictureBox_1_1, pictureBox_1_2},
        {pictureBox_2_1, pictureBox_2_2},
        {pictureBox_3_1, pictureBox_3_2},
        {pictureBox_4_1, pictureBox_4_2},
        {pictureBox_5_1, pictureBox_5_2},
        {pictureBox_6_1, pictureBox_6_2}}

        ' add images to the list
        list.Add(footstep)
        list.Add(nostep)

        ' create random images
        createRandomImages()

        ' add event to the pictureboxes
        AddEventToAllPictureboxes(Nothing, Nothing)

        ' enable pictureBoxes
        enablePicBox(counter)

    End Sub

    ' populate the imagesOrder with images in a random order 
    Public Sub createRandomImages()

        'RichTextBox1.Text = ""

        For i As Integer = 0 To 6 - 1
            randomImage = CType(list(random.[Next](list.Count)), Bitmap)
            imagesOrder(i, 0) = randomImage

            If randomImage.Equals(footstep) Then
                imagesOrder(i, 1) = nostep

                'RichTextBox1.Text = RichTextBox1.Text + "Footstep - "
                'RichTextBox1.Text = RichTextBox1.Text + "Nostep"
                'RichTextBox1.Text = RichTextBox1.Text + Environment.NewLine

            Else
                imagesOrder(i, 1) = footstep
                'RichTextBox1.Text = RichTextBox1.Text + "Nostep - "
                'RichTextBox1.Text = RichTextBox1.Text + "Footstep"
                'RichTextBox1.Text = RichTextBox1.Text + Environment.NewLine
            End If
        Next
    End Sub

    ' create an event for the pictureboxes in the top panel
    Public Sub paneltop_picBoxes_click(ByVal sender As Object, ByVal e As EventArgs)
        Dim pbox As PictureBox = CType(sender, PictureBox)

        If pbox.Enabled Then
            pbox.Image = imagesOrder(counter, 1)
            pbox.Enabled = False
            picBoxes(counter, 0).Enabled = False

            If imagesOrder(counter, 1).Equals(nostep) Then
                won = False
            End If

            If counter = 5 AndAlso won = True Then
                pictureBoxFinish.Image = footstep
                label_message.Text = "You've Won"
            ElseIf won = False Then
                label_message.Text = "You've Lost"
            End If

            counter += 1
            enablePicBox(counter)
        End If
    End Sub

    ' create an event for the pictureboxes in the bottom panel
    Public Sub panelbottom_picBoxes_click(ByVal sender As Object, ByVal e As EventArgs)
        Dim pbox As PictureBox = CType(sender, PictureBox)

        If pbox.Enabled Then
            pbox.Image = imagesOrder(counter, 0)
            pbox.Enabled = False
            picBoxes(counter, 1).Enabled = False

            If imagesOrder(counter, 0).Equals(nostep) Then
                won = False
            End If

            If counter = 5 AndAlso won = True Then
                pictureBoxFinish.Image = footstep
                label_message.Text = "You've Won"
            ElseIf won = False Then
                label_message.Text = "You've Lost"
            End If

            counter += 1
            enablePicBox(counter)
        End If
    End Sub

    ' add event to all pictureboxes
    Public Sub AddEventToAllPictureboxes(ByVal sender As Object, ByVal e As EventArgs)
        For Each c As Control In panel_top.Controls

            If TypeOf c Is PictureBox Then
                AddHandler c.Click, AddressOf paneltop_picBoxes_click
            End If
        Next

        For Each c As Control In panel_bottom.Controls

            If TypeOf c Is PictureBox Then
                AddHandler c.Click, AddressOf panelbottom_picBoxes_click
            End If
        Next
    End Sub

    Public Sub enablePicBox(ByVal index As Integer)
        If index <= 5 Then
            picBoxes(index, 0).Enabled = True
            picBoxes(index, 1).Enabled = True
        End If
    End Sub


    Public Sub disableAllPicBox()

        For Each c As Control In panel_top.Controls

            If TypeOf c Is PictureBox Then

                c.Enabled = False

            End If
        Next

        For Each c As Control In panel_bottom.Controls

            If TypeOf c Is PictureBox Then

                c.Enabled = False

            End If
        Next

    End Sub



    Private Sub buttonRestart_Click(sender As Object, e As EventArgs) Handles buttonRestart.Click

        createRandomImages()
        disableAllPicBox()
        won = True
        counter = 0
        label_message.Text = ""
        enablePicBox(counter)
        pictureBoxFinish.Image = Nothing

        For Each pbox As PictureBox In picBoxes
            pbox.Image = Nothing
        Next

    End Sub
End Class


OutPut:

Glass Bridge Game In VB.Net

glass stepping stones game in vb.net

squid game - glass stepping stones game In vb.net

glass bridge game from squid game using vb.net





if you want the source code click on the download button below