I'm trying to build an application that manages a small database, with a TableAdapter. The problem is that the SaveItem button doesn't work.
This is the code:
Private Sub PeopleBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles PeopleBindingNavigatorSaveItem.Click
Me.Validate()
Me.PeopleBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.BankDataSet)
End Sub
Thank you to all!
Related
I'm trying to figure out how to disable my form(Form1.vb) without hiding it then enabling it after I'm done with the other form(Form2.vb).
I've searched on youtube but it says C#. I've tried it but somehow it was indicated as an error in VS 2015. I tried messing around with the syntax because I really can't figure it out. The syntax that I have tried is "LandingForm.ActiveForm.Owner.Enabled = True".
Indicated below are the codes of my system. The first one is form1.vb/LandingForm.vb and the second one is form2.vb/AcctSettings.vb.
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Enabled = False
AcctSettings.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
LandingForm.ActiveForm.Owner.Enabled = True
Me.Hide()
End Sub
Am I missing something? Can somebody help?
On your form1 just have a simple line like
Form2.Show()
wherever/however you wish to open the other form (button etc.)
then in the code for that form2 in the formload handeler have
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Form1.Enabled = False
End Sub
This will keep form1 open but basically grey it out.
Then have a simple button click like so to have access to form 1.
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Form1.Enabled = True
End Sub
And you are done! And if you wish just add another button or a IF statement to the button2 sub and say form1.enabled = false if you want to be able to enable/disable etc.
To enable/disable your userform :
To disable your userform you will need yo enable it before :
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Form1.Enabled = True
Form1.Enabled = False
End Sub
To disable it will be easier you just got to set your userform.enabled as False
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Form2.Enabled = True
End Sub
If you want to close your userform useroform.Unload might be the solution.
In your code it would be like this :
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Enabled = False
AcctSettings.Show()
form1.Unload
End Sub
and
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
LandingForm.ActiveForm.Owner.Enabled = True
Me.Hide()
form2.Unload
End Sub
an other option is to Hide your user form : it will just hide the userform and will not release the objects and variables from the memory. Where as Unload method will release the objects and variables from the memory.
UserForm1.Hide
To conclude : Hide method will be used when we want to hide the form temorarly and to show after sometime to the user. Where as unload will be used when it completes the task.
Note that this is YourUserForm_Name.Unload
i'm just a beginner here, please help me to solve my problem, and actually i didn't have a code yet for this.
i have a 2 flow out panel and have a buttons. the Menu button in the upper side and the Menu button in the bottom side. how can i click them at the same time?
No you cannot do that, but there is a way to achieve your problem,
Do something like this,
This is only a suggestion..
Private Sub btnMenuUpper_Click(sender As Object, e As EventArgs) Handles btnMenuUpper.Click
'Code Here
End Sub
That's the first button and that will be activate also the second button.
Private Sub btnMenuBottom_Click(sender As Object, e As EventArgs) Handles btnMenuBottom.Click
'Code Here
End Sub
And just call the btnMenuBottom to btnMenuUpper.
Private Sub btnMenuUpper_Click(sender As Object, e As EventArgs) Handles btnMenuUpper.Click
'Code
btnMenuBottom_Click(sender, e)
End Sub
This should work
Private Sub btn1_click(sender as object, e as EventArgs) handles btn1.click
btn2.performclick
end sub
i need to create system tray "panel" like Windows Media Player.
(not icon only, but complette form with buttons, images, etc.)
Here is wmp screenshot:
Is it possible in VB.NET & Win 10?
Thanks and sorry for my english.. :)
You actually can do kind of a "tray panel", and it isn't quite difficult. Just create a Form Object and set its FormBorderStyle property to None, which will allow you to create your custom border. Then, do the following:
Public Class Form1
Public Timer1 As New Timer
Private Sub Form1_Load(sender as Object, e as Eventargs) Handles MyBase.Load
Timer1.Interval = 1
End Sub
Private Sub Form1_MouseDown(sender as Object, e as MouseEventargs)
Timer1.Start()
End Sub
Private Sub Form1_MouseUp(sender as Object, e as MouseEventargs)
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(sender as Object, e as Eventargs)
Me.Location = New Point(Me.Cursor.Position.X - (Me.Cursor.Position.X - Me.Location.X), Me.Cursor.Position.Y - (Me.Cursor.Position.Y - Me.Location.Y))
End Sub
End Class
Once you've done that (I'm not sure it will work directly, try a bit and it should), enjoy designing the GUI... ;-)
Hope this helps and by the way, your english is better than you think!
I searched over the Stackoverflow and Google about solution for my problem but no way! so it's the time to ask my own question.
I'm making a big project using C# and VB.net (not our topic -_-)
I opened this question to ask about VB.net problem
I'm trying to load a lot of forms but in the same time, hide the previous form!
Firstly, look here on Form1:
Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
If Label1.Text = "Setting profile.dat=Roblox.AuthAccess ..." Then
Form2.Show()
Me.Hide()
End If
End Sub
This is a timer, which detect if Label1's Text is "Setting profile.dat=Roblox.AuthAccess ..." it must show Form2 and then close Form1 (THIS IS WORKING PERFECTLY) :-)
Form2:
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If WebBrowser1.Url.ToString().Contains("home") Then
Me.Hide()
Form3.Show()
End If
End Sub
This will detect if "WebBrowser1"'s URL does contain "home" then it will hide Form2 and show Form3 (AND HERE THE PROBLEM STARTED!!!)
Problem is: It shows Form3 then after 2 seconds, Form2 come back again (now both are opened once) and they're opening and closing forever (I close them by going to Task Manager and ending "vshost32.exe")
Form3:
Public Class Form3
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Form2.Close()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Form4.Show()
End Sub
End Class
Actually, stopping timers is still not a stable solution and disabling them are more better.
Just replace Timer4.Stop() with Timer4.Enabled = False .
Thank you very much #jmcilhinney :)
I never thought about stopping every "Timer" after it's job had finished!
Just replaced Timer4_Tick with:
Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
If Label1.Text = "Setting profile.dat=Roblox.AuthAccess ..." Then
Me.Hide()
Form2.Show()
Timer4.Stop()
End If
End Sub
So at last, I fixed that by adding Timer4.Stop() .
***THE CODE FROM THE FIRST WINDOW GOES INTO A TEXT BOX AND YOU HIT THE BUTTON HERE.
Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click
Me.Close()
End Sub
***THE CODE ON THE FORM WHERE I WANT THE INFO TO BE PLACED IS HERE.
Private Sub Loan1Form_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.lblCompanyName.Text = DataEntryForm.txtCompanyNameInput.Text
End Sub
Anyway's that's what I found on a youtube video and im having trouble getting it to work. Any help would be appreciated.
Thanks.
Pass the data to an instance of the form:
Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click
Dim f As New OtherForm
f.lblCompanyName.Text = txtCompanyNameInput.Text
f.Show()
Me.Close() 'make sure this form is not the one that closes the app if it closes
End Sub