Buttonclick is not working VB.NET - vb.net

Can you help me with this, my code doesn't have error but when I click the button to go back to the previous group box it doesn't work :( Idk why can you help me guys figure it out?
The app has login form when you login it directs you to the another form that you can choose categories then if I select a category example I chose gadgets it redirects me to the gadgets groupbox then if I try to go back it doesn't go back in the categories page
The button2.click, button6.click and button3.click are the back buttons
Here's my code
Public Class Form3
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
GroupBox2.Show()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sbutton As DialogResult
sbutton = MessageBox.Show("Do you want to logout now?", "Logging out", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If sbutton = DialogResult.Yes Then
Form1.Show()
Me.Hide()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
GroupBox1.Show()
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
GroupBox3.Show()
End Sub
Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
GroupBox4.Show()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
MsgBox("Message was sent!", MsgBoxStyle.Information)
TextBox1.Clear()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
GroupBox2.Show()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
MsgBox("Message was sent!", MsgBoxStyle.Information)
TextBox2.Clear()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
GroupBox2.Show()
GroupBox3.Hide()
End Sub
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
GroupBox2.Hide()
GroupBox3.Hide()
GroupBox4.Hide()
End Sub
End Class

Umm did you type this yourself or generate it from a UI? Shouldn't it be button_OnClick not button_click?

Related

How to update a progress bar while copying and pasting in Visual Basic

Hello Stack overflow community, I am here to get some help for a tool that I am programming in VB.net, I am using Visual Studio 2015 and what I am working on right now is a tool that basically creates a backup of a folder, it basically copies all files from a path that it's given in TextBox1 to the path that it's given in TextBox2, when the user presses the button "Create", it will execute this code:
My.Computer.FileSystem.CopyDirectory(TextBox1.Text, TextBox2.Text, True)
It works perfectly but what I want to do is, the progress bar that I have added to be updated during the copy paste process so the user can know that it's actually working.
The whole code is here:
Public Class Form4
Private Sub FolderBrowserDialog1_HelpRequest(sender As Object, e As EventArgs)
End Sub
Private Sub FolderBrowserDialog2_HelpRequest(sender As Object, e As EventArgs)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
FolderBrowserDialog1.ShowDialog()
End Sub
Private Sub FolderBrowserDialog1_Disposed(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = FolderBrowserDialog1.SelectedPath.ToArray
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
FolderBrowserDialog2.ShowDialog()
End Sub
Private Sub FolderBrowserDialog2_Disposed(sender As Object, e As EventArgs) Handles Button2.Click
TextBox2.Text = FolderBrowserDialog2.SelectedPath.ToArray
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
My.Computer.FileSystem.CopyDirectory(TextBox1.Text, TextBox2.Text, True)
TextBox1.Clear()
TextBox2.Clear()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Me.Hide()
Form3.Show()
End Sub
End Class
If there's anything else that I haven't explained, let me know, thank you.

How to add next and previous button in access database using visual basic?

I have used movePrevious() method and moveNext() method but that does not work once I search through the database. I mean that thing works fine when I first load the form but after I search for certain value and then try to use the button it dies not work. Remember I am just a beginner in visual basic.
Private Sub EmployeeBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
Me.Validate()
Me.EmployeeBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.CEMPLOYEEDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Me.EmployeeTableAdapter.emp_id(Me.CEMPLOYEEDataSet.Employee, New System.Nullable(Of Integer)(CType(TextBox1.Text, Integer)))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
EmployeeBindingSource.MovePrevious()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
EmployeeBindingSource.MoveNext()
End Sub
Picture of my form

vb.net button visibility based on checkbox

So i have a form as below:
Public Class IPADSOFT
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
IPADSOFTTS.Show()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Me.Hide()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
HOME.Show()
Me.Hide()
End Sub
End Class
which has 3 checkboxes labeled IPADSOFTBOX1, IPADSOFTBOX2, IPADSOFTBOX3
So... i have another form as follows:
Public Class IPADSOFTTS
Private Sub onload()
If IPADSOFT.IPADSOFTBOX1.Checked Then
Button1.Visible = True
Button3.Visible = True
Button5.Visible = True
End If
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Me.Hide()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
HOME.Show()
IPADSOFT.Hide()
Me.Hide()
End Sub
End Class
Now the idea is that all the buttons on that second form are set to visible-false and i want the page to check which checkboxes are checked on the last form and then make the required buttons on this form visible... but it isnt working
What am i doing wrong?? i apologise im very very new to vb.net
Open the second form with this
Dim newForm As New IPADSOFTTS With
{.MainForm = Me}
newForm .Show()
Set Public MainForm As IPADSOFT below the Public Class of second form
Then use in the Load event
if MainForm.IPADSOFTBOX1.Checked = true then
'Do whatever
End if

why wont this visual basic script work?

i am getting really annoyed by this piece of code for visual basic
please can you help. i have looked on YouTube and everywhere else even the vb website!!! i would really appreciate it if someone could help me out
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MessageBox.Show("Hi!!")
Timer1.Start()
End Sub
Private Sub ProgressBar1_Click(sender As Object, e As EventArgs) Handles ProgressBar1.Click
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(1)
If ProgressBar1.Value = 100 Then
Timer1.Stop()
MsgBox("Jeff")
End If
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
End Sub
Private Function GetNumericUpDown1(v As Integer) As Boolean
End Function
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
If ( : ( ) Then
MessageBox.Show("Well Done!")
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
MessageBox.Show("!!Stopped!!")
Timer2.Stop()
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
ProgressBar2.Increment(0.6)
If ProgressBar2.Value = 100 Then
Timer2.Stop()
MsgBox("Jeff")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
MessageBox.Show("!!Started!!")
Timer2.Start()
End Sub
Private Sub SplitContainer1_Panel1_Paint(sender As Object, e As PaintEventArgs) Handles SplitContainer1.Panel1.Paint
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(sender As Object, e As MouseEventArgs)
End Sub
Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs)
End Sub
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
ProgressBar3.Increment(1)
If ProgressBar3.Value = 100 Then
Timer3.Stop()
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Timer3.Start()
End Sub
Private Sub ProgressBar3_Click(sender As Object, e As EventArgs) Handles ProgressBar3.Click
End Sub
End Class
BTW:this is my first post so it is probably rubbish!!
I don't have enough points to comment.
First off, as others have said we can't recreate this since we have no idea what your Form looks like or what you are expecting it to do.
Secondly, you should turn on Option Strict in the Compile section of Project properties to avoid technical errors like ProgressBar2.Increment(0.6) since 0.6 isn't a valid integer.
I threw together a TabControl (which you never mentioned in the OP) with 3 tabs and the various buttons and progress bars you list in what seemed like a logical fashion to me and it ran just fine for what code you have. Clicked the button on each tab and each progress bar eventually got to 100%. I have no idea what else you were expecting.
If you remove all the empty subs and action listeners, it would be easier to detect the problem

Vb.net Error then use form4.show

I have a little problem with my program. I just maked a little program. I have a problem with code "Form4.Show()".
I put this code on button and then press button I receive error:
An error occurred creating the form. See Exception.IneerException for details. The error is: Object reference not set to an instance of an object.
I don't know what code I put wrong ... this button have only form4.show.
PS: this error is from try catch.
This is button code.
Try
Form4.Show
Catch ex as Exception
MessageBox.Show(ex.Message)
End Try
edit: all form4 code
Public Class Form4
Dim txt As String = Textbox1.Text
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
txt = "450IP-Gift"
Form5.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
txt = "450IP"
Form5.Show()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
txt = "1150IP-Gift"
Form5.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
txt = "1150IP"
Form5.Show()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
txt = "3150IP-Gift"
Form5.Show()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
txt = "3150IP"
Form5.Show()
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
txt = "4800IP-Gift"
Form5.Show()
End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
txt = "4800IP"
Form5.Show()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
txt = "6300IP-Gift"
Form5.Show()
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
txt = "6300IP"
Form5.Show()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
txt = "9600IP-Gift"
Form5.Show()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
txt = "9600IP"
Form5.Show()
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
Me.Close()
End Sub
End Class
You need to initialize form4
Try
Dim form4 = New Form4()
form4.Show()
Catch ex as Exception
MessageBox.Show(ex.Message)
End Try