Jump to content

VB.Net - Button first to redefine its own text and then open other form

Go to solution Solved by madknight3,

No, that's ok.  Basically what I really want is no pop up boxes.  That is the main goal.  

Yeah, but you'll also need to figure out what you what it to do. When you know that, we can help you get there if it's something that's possible to do (if you even need help).

 

Maybe you'll go with different click events as described above.

 

Maybe you use keyboard short cuts.

 

Maybe you want some sort of "Edit/Configure" option that makes all the text boxes on screen editable at one time with "Finish/Save and Cancel" options for when you're done. Maybe this option is hidden unless you hover your mouse over a certain area of the form (ex: one of the top corners).

 

Those are just some examples. You may be able to come up with something much better.

Hi all,

 

I am building a school planner for fun.  Some of you may have seen previous posts about it.

 

I have implemented code with help from fellow LinusTechTipsters regarding the code to employ.

 

I will most likely be exploring WPF for this idea in the future, but for now, I am going to try and continue cutting my teeth with a basic Windows Form:

 

The Main Form consists of buttons that access separate Forms for each school class (biology, chemistry, etc.).

 

With advice here, I have placed a text box over the button that accesses each class.  When the text box is clicked, it allows me to edit the text of the button, and then the text box disappears.  This allows it to appear as a custom control, I suppose, where everything is self contained and there are no pop up, input boxes to enter information.  This is the goal for this project.  I want it to seem as intuitive as possible, MAYBE something like an Apple product, if you know what I mean.  Just as in, sleek, minimal stuff to get lost in, etc.  

 

So, I have a disappearing text box over the button which changes the button text after inputing the name of the class into the text box.

 

Now, I have a problem of designing the program to where I can access each separate form in this type of order:

 

Event: Button Click

Enter input (name of the class) into text box

Press Enter

Text Box Disappears

Button is now named whatever you name it

 

Event: 2nd mouse click on the same button

Form2.Show (which will be the designated class form ie. Biology, Chemistry, etc.)

 

What code would be useful for determining the 2nd mouse click to open the separate form, after it's been renamed with the first event?

 

(As you can see in the photo, it is a Sci-Fi themed planner :P)

PlannerC

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

You could do something like this in the button click event.

If Button1.Text.Equals("Default Text")    // Rename like you're currently doingElse    Form2.Show()End If

However that only lets them rename once. What if they made a mistake? Maybe you need to use different events. Single click to edit name, double click to open form (or vice versa). Just an idea.

Link to comment
Share on other sites

Link to post
Share on other sites

You could do something like this in the button click event.

If Not Button1.Text.Equals("Default Text")    Form2.Show()Else    // Rename like you're currently doingEnd If

However that only lets them rename once. What if they made a mistake? Maybe you need to use different events. Single click to edit name, double click to open form (or vice versa). Just an idea.

That's true - someone in another forum had suggested doing right click to rename, and then left click I suppose after it is renamed to show the separate form.  

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

It would be cool if I could "hijack" the available controls in some creative way to do what I want only because I haven't looked into custom controls or WPF, yet.  This has also been a really good learning experience since I am new to Visual Basic.

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

That's true - someone in another forum had suggested doing right click to rename, and then left click I suppose after it is renamed to show the separate form.  

That is also an option. It all depends on what you think is best for your users.

 

 

It would be cool if I could "hijack" the available controls in some creative way to do what I want only because I haven't looked into custom controls or WPF, yet.  This has also been a really good learning experience since I am new to Visual Basic.

 

Also, I'm not sure what you mean "hijack" the available controls in some creative way to do what I want

 

Do you want to do something else with them that you haven't said in your original post?

Link to comment
Share on other sites

Link to post
Share on other sites

That is also an option. It all depends on what you think is best for your users.

 

 
 

 

Also, I'm not sure what you mean by "hijack"

 

Haha, yeah, I just meant doing what I can with what is available instead of doing custom control :P

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

Haha, yeah, I just meant doing what I can with what is available instead of doing custom control :P

Sorry, I edited my last post for better clarification on what I meant to ask.

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry, I edited my post last for better clarification on what I meant to ask.

No, that's ok.  Basically what I really want is no pop up boxes.  That is the main goal.  

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

No, that's ok.  Basically what I really want is no pop up boxes.  That is the main goal.  

Yeah, but you'll also need to figure out what you what it to do. When you know that, we can help you get there if it's something that's possible to do (if you even need help).

 

Maybe you'll go with different click events as described above.

 

Maybe you use keyboard short cuts.

 

Maybe you want some sort of "Edit/Configure" option that makes all the text boxes on screen editable at one time with "Finish/Save and Cancel" options for when you're done. Maybe this option is hidden unless you hover your mouse over a certain area of the form (ex: one of the top corners).

 

Those are just some examples. You may be able to come up with something much better.

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, but you'll also need to figure out what you what it to do. When you know that, we can help you get there if it's something that's possible to do (if you even need help).

 

Maybe you'll go with different click events as described above.

 

Maybe you use keyboard short cuts.

 

Maybe you want some sort of "Edit/Configure" option that makes all the text boxes on screen editable at one time with "Finish/Save and Cancel" options for when you're done. Maybe this option is hidden unless you hover your mouse over a certain area of the form (ex: one of the top corners).

 

Those are just some examples. You may be able to come up with something much better.

Those are all great ideas.  I suppose I am also just looking for input as far as what I want to do.  Thanks.  

ASRock B550M PG RIPTIDE       Corsair Vengeance 16 GB DDR4             TEAMGROUP MP33 1 TB NVME SSD

AMD Ryzen 5 5600X                   Antec DF700 Case                                 MSI Radeon RX 580 4 GB ARMOR OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×