I made a nice program while learning and everything was going good until I did something, but I forgot what I did. Now the buttons won't click but they all have the functions.
I know it's something in the properties but I forgot what it was.
vb.net express 2013
Without code provided, we can't really help that much. But what you can do is create another button, then copy whatever the code of your old button was, and paste it to your new button created.
In Visual Studio when you cut and paste any Control instead of simply drag it in a new position it will lost every event handler already added.
In your case simply add Handles clause to your YourButtonName_Click sub:
Private Sub YourButtonName_Click(sender As System.Object, e As System.EventArgs) Handles YourButtonName.Click
Related
Sure I am being a bit thick but can anyone tell me how I can add a save button to the Krypton Ribbon file tab. For all other tabs I can drag from the toolbox but I cant for the life of me figure out how to add a button or anything else to the file tab. I'm using vb.net and cant find anything on google explaining how to do this at all
Many Thanks
Gibbo
Figured it out, was being daft, in the properties of the ribbon you can add a button in the RibbonAppButton to AppButton MenuItems/ AppButtonSpecs.
Then just add an onclick event in the code
Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles BtnSave.Click
Thanks for looking
I was going to build my project when i noticed i didn't put an icon,
and since i couldn't access the icon value of the original form because i used a theme i C+X the container and access it from the grey form, change it, C+V the container, built the project.
Nothing changed, all the name of the buttons and stuff are the same, but i feel like nothing is connected to the code anymore, i don't know what happened, i just recently got re-interested into coding, and i have no idea what to do, i tried some things but nothing worked, so here i am, desperate (i spent 3 days on this, i'm REALLY starting from bottom)
link to the project: http://www.mediafire.com/file/2zrbe32lzpx2qhz/SchedulerProjectVBNET.rar
Thanks in advance
It sounds like you have lost all the Handles clauses off your event handlers. As an example, if you add a Button to your form and double-click it, you will get a Click event handler like this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Note the Handles clause at the end, which is what connects the code to the event of the control. If you cut that Button from your form to the Clipboard then it no longer exists as part of the form, so that Handles clause will be automatically removed. If you paste the Button back onto the form, the Handles clause is not restored, so the method no longer handles the event.
If that's what has happened - which you can easily check just by looking at the code - then you need to restore all those Handles clauses. You can do that manually, i.e. write them all yourself in the code window, or you can have the designer regenerate them for you. To do the latter, select a control in the designer, open the Properties window, click the Events button, select the desired event and then select the appropriate method from the drop-down list.
Note that you can also double-click an event there to generate a new event handler, which can be useful for handling events other than the default event. You can generate a handler for the default event simply by double-clicking the control.
I am making a VB.Net web browser, and to make the whole thing look nice, when the user right clicks, I want a groupbox to show up where the mouse was right clicked. I am using the ChromeWebBrowser.Net project on SourceForge and when I add the following code:
Private Sub ChromeWebBrowser1_MouseUp(sender As Object, e As MouseEventArgs) Handles ChromeWebBrowser1.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
GroupBox1.Location = (e.Location)
GroupBox1.Visible = True
Else
End If
End Sub
It should be working, but when I test it and right click on the web browser control, it does not show up. When I add the same code to the main forms code, it works fine, it just is not working on the browsing control. No errors or anything, it will just not show up. Is there something special I need to do, or can there be a workaround to this?
Thanks so much!
Honestly, this sounds more like you should be using a ContextMenuStrip. You can drop one onto your form(then add items to it), and finally after that you can set the webbrowser's contextmenustrip property to be the one you just designed.
Ok, I'm aware there's a lots of topis about this, but I haven't found anything that works for me.
My program generates a small picture that i would like to keep in a WinForm that's always at the bottom, "with the desktop". Something like the gadgets in windows 7.
How do i tell my form to always stay here, and just can't be visible over any other form/window?
Should'nt this be doable like in the form_load function for this window?
Like this
Private Sub Sticky_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeepMeAtTheBottomUntillIAmClosed
End Sub
If you create a form that has no border and no controlbox, the user will not be able to resize or move it. Then add your own button to allow it to close, tell it where you want it to be and tada!
You can even add some mouse over functionality to make the tools appear when you are over the form.
In my project, I'm adding a ListBox whose items are retrieved from a database. What I want to do is to add a button to the right of each item on the ListBox that, when pressed, deletes that item from the database and refreshes the ListBox.
Now, getting the button to do that will be easy (quite possibly a Click() event on the button), but my problem is that I can't find a way to actually add a button to the ListBox.
Does anyone know how to do this?
BTW this is in a VB desktop app project.
A DataGridView would be an easier solution, it already includes all the functionality you require. Simply add a text column and a button column, then you can subscribe to the Cell ContentClick event For example:
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
'your database code here
DataGridView1.Rows.RemoveAt(e.RowIndex)
End Sub
There's an article on the msdn about putting controls into DataGridViews. Check this out and see if it gets you any closer to what you want.
http://msdn.microsoft.com/en-us/library/7tas5c80.aspx