If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: How to prevent a TabItem from being selected

Originally Posted by Kram Kramer

But converted code doesnt work.

Did you miss this part of my previous post:

if you have any issues, we can help you fix them.

I'm not seeing where you've provided any information about those issues. If you want use to help you with conversion issues then you should be providing the original code (as formatted text in your post, not an off-site image) and the converted code, along with specific details of what "doesn't work" actually means so that we have an idea what to look for. That's how you help us help you.

Alternatively, download Instant VB from Tangible Software Solutions. There's a free version and it will likely produce an error-free result.

Re: How to prevent a TabItem from being selected

Re: How to prevent a TabItem from being selected

For one thing, the first method is a constructor, so the code it contains should be put into the New sub in your VB window, because that's the constructor. Also, does your window contain a TabControl named 'tab'?

Re: How to prevent a TabItem from being selected

So, you're just ignoring the bit about the constructor? Create an appropriate window, i.e. a window with the appropriate control(s) and then add a constructor to the code. Next, copy the code from the first method (which is a constructor in the C# code) and then copy the second method (the event handler) as is. If you still have issues, please describe them clearly. Don't post screenshots. Post the code, highlight the lines that are at issue and describe the issues, which means providing error messages if there are any.

Re: How to prevent a TabItem from being selected

If all you're going to do is copy code from elsewhere then that's your prerogative but that's not programming, so I'm not much interested in helping you do that. If you want to learn how to program then you actually need to learn the basics first and then apply them. People should be able to use terms like class, method, property, constructor, event, etc and you should know what they mean or know how to find out. We shouldn't have to teach the basics each time we answer a specific question. As I said, what you do is up to you but if you want to jump in without a decent grounding in the fundamentals then you're going to get stuck on easy stuff and I don't see it as my job to help people with the easy stuff that they can find for themselves without much effort. I want to help with the hard stuff that people have attempted but can't get on their own. How to write a constructor doesn't fall into that category as far as I'm concerned. Others may feel differently and you're welcome to wait and see if someone else does, but It would be a good idea to research the fundamentals in the mean time.

Re: How to prevent a TabItem from being selected

Based from the screenshot provided, you need to import the System.ComponentModel namespace to use the CurrentChangingEventArgs class and make sure to add a checkbox control with name chk in your XAML since it's looking for that control which does not exist in your XAML.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.