passing a parameter to fillby(vb.net) - vb.net

I have problem passing a parameter to fillby
I made fill method call FillByA but there is problem!!
its said:
“too many arguments to ‘public override Overloads function fillbyA(data Table as ContactsDataSet.recordsDataTable) as integer’
This is my code:
Public Class Adminlogin
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text.Trim = "" Or TextBox2.Text.Trim = "" Then
MsgBox("you should complet ypur deails")
Else
//error happen here !
Me.AdminTableAdapter.FillByA(Me.UserDataSet1.Admin, Me.TextBox1.Text.Trim, Me.TextBox2.Text.Trim)
If Me.UserDataSet1.user.Count > 0 Then
Me.Close()
Test.Show()
Else
MsgBox("Logon failure, user name or password are incorrect!", MsgBoxStyle.Critical)
End If
End If
End Sub
Private Sub Ad_NameTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
If IsNumeric(e.KeyChar.ToString()) Then
MessageBox.Show("Letters only!")
SendKeys.Send("{Backspace}")
End If
End Sub
Private Sub Ad_NameTextBox_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
admincon.Show()
End Sub
End Class

Related

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

Input Strings into String Arrays(Dynamic)

So I have two string arrays, one for my friends, the other for their numbers. I go to my combo box (displays list of names) I click on it and it displays their number on a label. My problem is I want the user to a enter a new name and number in 2 textboxes, then transfer the name on the combo box. Once their name is in the box, I click on it and it display's their number on label. Is there a way to transfer the new items onto my arrays?
Option Explicit On
Module MainModule
Public strPeople() As String = {"Kyle", "John", "Jake", "Donna", "Carly", "Ty", "Mavis"}
Public strPhoneNumbers() As String = {"945-1232", "804-2329", "290-7321", "928-4569", "205-9893", "320-0195", "305-4520"}
Public tempList As New List(Of String)
End Module
Here Is My Main Form
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.AddRange(strPeople)
End Sub
Private Sub AboutToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem1.Click
AboutBox1.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
Application.Exit()
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim strPhoneNums As String = strPhoneNumbers(ComboBox1.SelectedIndex)
Label3.Text = "Phone Number: " & strPhoneNums
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
//Add Contact Button
If TextBox1.Text <> "" Then
ReDim Preserve strPeople(7)
strPeople(7) = TextBox1.Text
ComboBox1.Items.Add(strPeople(7))
End If
If TextBox2.Text <> "" Then
ReDim Preserve strPhoneNumbers(7)
strPhoneNumbers(7) = TextBox2.Text
End If
TextBox1.Clear()
TextBox2.Clear()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Application.Exit()
End Sub

Buttonclick is not working 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?

I'm trying to open a form and getting this error

Okay, here is my code.
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 1000
ProgressBar1.Value = 1000
Timer1.Interval = 1750
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Form3.Show()
Me.Close()
End Sub
End Class
On the line Form3.Show() I get
InvalidOperationException was unhandled.
An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.
What I have on Form3:
Public Class Form3
Public IPAddress As String = TextBox1.Text
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form4.Show()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Form4.varible1 = True Then
Label1.Text = "IP: " + IPAddress
End If
End Sub
End Class
Any help?
Change on form3
Public IPAddress As String = TextBox1.Text ...."TextBox1.Text is "" thats why you get the error"
To
Public IPAddress As String
End then add IPAddress = TextBox1.Text in you timer
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Form4.varible1 = True Then
IPAddress = TextBox1.Text
Label1.Text = "IP: " + IPAddress
End If
End Sub

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