Let me know in the comments which project you plan to build first, or share your own VB project ideas below! Happy coding! 🚀
Public Class Calculator Dim currentInput As String = "" Dim firstNumber As Double = 0 Dim operation As String = "" Private Sub Number_Click(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click, '... etc Dim btn As Button = CType(sender, Button) currentInput &= btn.Text txtDisplay.Text = currentInput End Sub
Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click If imageFiles IsNot Nothing Then currentIndex = (currentIndex + 1) Mod imageFiles.Length ShowImage() End If End Sub
Private Sub ComputerMove() If Not gameActive Then Exit Sub Dim emptyCells As New List(Of Tuple(Of Integer, Integer)) For i = 0 To 2 For j = 0 To 2 If board(i, j) = "" Then emptyCells.Add(Tuple.Create(i, j)) Next Next visual basic projects with source code
Imports System.IO Public Class TodoApp Private tasksFile As String = "tasks.txt"
Imports System.IO Public Class ImageViewer Private imageFiles As String() = Nothing Private currentIndex As Integer = 0
Select Case operation Case "+" : result = firstNumber + secondNumber Case "-" : result = firstNumber - secondNumber Case "*" : result = firstNumber * secondNumber Case "/" : result = firstNumber / secondNumber End Select Let me know in the comments which project
If CheckWin(player) Then lblStatus.Text = $"{player} wins!" gameActive = False ElseIf IsDraw() Then lblStatus.Text = "Draw!" gameActive = False End If End Sub
Private Sub LoadData() Dim adapter As New SQLiteDataAdapter("SELECT * FROM Students", conn) Dim table As New DataTable() adapter.Fill(table) DataGridView1.DataSource = table End Sub
Private Sub ShowImage() If imageFiles IsNot Nothing AndAlso imageFiles.Length > 0 Then picImage.Image = Image.FromFile(imageFiles(currentIndex)) Me.Text = $"Image Viewer - {Path.GetFileName(imageFiles(currentIndex))}" End If End Sub etc Dim btn As Button = CType(sender, Button)
Private Sub btnEquals_Click(sender As Object, e As EventArgs) Handles btnEquals.Click Dim secondNumber As Double = Double.Parse(currentInput) Dim result As Double = 0
txtDisplay.Text = result.ToString() currentInput = result.ToString() End Sub