I have a problem with vb.net tabcontrol in so far as I cannot change the individual tab widths. I can chang ethe sizecontrol to fixed and alter all of the tabs but not individually. Ordinarily it would not be a problem with the tabs autosizing by the text size, but I have sometimes in my programme tabs with no content which I would like to hide, this I thought would be easy as just give it no name, but the tab remains and the size seems to have a minimum which is too big.
So to summerize. I want to hide dynamically one or more tabs in tabcontrol.
I dont know what is happening with my programme. But it has now decided to work. I have made no changes since it was not working, but I was working in Access in another window, which is now closed. However even when I open access my programme still works. Very odd.
And if you want realy odd, I am now stuck on the wierdest fault I have ever encountered.
When opening an access DB using the following ver simple code:
I inserts row 7
However if I use this code:
tab1 being the label for field1, it works fine.
to try to find this anomoly, I tried making a new table, same thing hapens. A new database, same thing happens. A copy of an old table - works until I add another field then it stops working again.
I have finally fixed it, and the fix was far to compecated to explain and I doubt would be much use to anyone as it was a human error as usual. As the original posting was fixed I will now close off this discussion.
Thanks to Qveen72 for the solution to removing the tab. One last interesting thing is that when I posted that his solution wasn't working, this was true and it was becasue of a completely obscure problem with a sql statement when accessing an access database, its worth remembering that something completely seperate can cause things to not work which are seemingly unrelated.
Whilst I thought it was working I have now come accross another problem. Your code works great upto the 5th tab, then I get an error:
InvalidArgument=Value of '6' is not valid for 'index'. Parameter name: index
Its almost like it thinks tabcontrol tabpages is a real array that has not been declared.
Yes I have 12 tabs, yes so tab 6 is the 7th one.
I have now figured out how to do this, and it seems that you can't use an index to remove tabs, you can use it for pretty much everything else but not remove.
So here is how I got it to work: