Creating a custom tab in Optimizer
Author: Panache
Creation Date: 12/17/2016 2:53 PM
profile picture

Panache

#1
I can't figure out (which I think has more to do with not knowing how to use Visual Studio than anything else) how to create a new custom tab.

In Visual Studio, from Solution Explorer, I right click on my project and click Add>User Control>User Control. I name it "Optimizer_Performance_Tab" and click Add, which adds the user control to my project. Inside the Initialize void, I insert

CODE:
Please log in to see this code.

and I get the error:

The name 'Optimizer_Performance_Tab' does not exist in the current context

I've spent a couple of hours Googling this and haven't been able to figure out what I'm doing wrong or what else I need to do. Any help would be greatly appreciated.
profile picture

LenMoz

#2
Here's the code I use to launch my custom tab, at the top of my Initialize method...
CODE:
Please log in to see this code.


Updating controls is tricky. You need callback to avoid cross thread violations...
Here's the code I use to write to the list box on my custom form:
CODE:
Please log in to see this code.
profile picture

Panache

#3
If we keep this up, you're going to have posted your entire code.

Unfortunately, I'm still stuck at the more basic level of not being able to create my custom tab.
profile picture

LenMoz

#4
QUOTE:
If we keep this up, you're going to have posted your entire code.
I just remember how painful this was.


My last shot... Is the custom tab variable declared having class scope (above all methods rather than within the Initialize method)?
CODE:
Please log in to see this code.
profile picture

Panache

#5
After lots of googling and trial and error, what was posted here isn't the right way to do it.
profile picture

Eugene

#6
QUOTE:
Unfortunately, when I try to add the custom tab, I'm getting an error that Custom_Tab.CustomTab is a "type", which is not valid in the given context.

How to solve '…is a 'type', which is not valid in the given context'? (C#)
profile picture

Panache

#7
Thanks Eugene. That solved the custom tabs problem.
profile picture

Panache

#8
Eugene -- I spend another day learning, and in the process, created a step by step how to create an example Optimizer in Visual Studio, including a custom settings UI and a custom tab. It only has one bug left, which is that the tab is not being populated. Debug.Print is showing that the value is being transferred to the tab UI, but the TextBox is blank.

I have a Word document for how to create the forms in Visual Basic, as well as the solution file, which I encourage you to put on your WIKI to help others avoid the pain that LenMoz and I have gone through. How would you like me to get these to you, so I can avoid publishing them on the forum? (See -- I do learn eventually.)

I would appreciate it if you could take a look at my example solution to try to figure out why the Custom Tab isn't being populated.
profile picture

Eugene

#9
Please create a support ticket and I'll take a look at your walkthrough when time permits. Thanks for sharing your experience.

P.S. Are the forms in Visual Basic for real? I guess this was a typo.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).