VS 2010 Keeping Track Of 'Active' Tabpage With Multiple TabControls?
Aug 11, 2010
I am building a sort of 'lightweight' Visual Studio, and I'm trying to implement the feature where you can drag tabs to different 'tab groups', viewing multiple tabs side by side.
I got nearly everything working, I show a ContextMenuStrip when you rightclick the tab headers, with the option of creating a new (horizontal or vertical) Tab Group. When that happens, a new TabControl is added dynamically and the selected tab is moved there. You can drag the tabs around inside a TabControl and even from one to another.
The problem now is keeping track of the 'active' tab. Since I have multiple TabControls (not just two, there can be as many as you want theoretically), their SelectedTab properties are basically useless. How am I to determine which TabControl the user is currently working in? Obviously I will always have multiple selected tabs, but only one active tab, in which the user is currently typing, editing, whatever.I need to know the active tab for obvious reasons: many menu and toolbar items act on the active tab for example. A short explanation of my controls:I have one TabGroupContainer control, which inherits UserControl. I have a TabGroup control, which inherits TabControl.I have a Tab control, which inherits TabPage.
The TabGroupContainer holds a collection of TabGroups (to which I dynamically add/remove TabGroups when required). Now I want the TabGroupContainer control to have the ActiveTab property which returns the one and only active tab (out of possibly many selected tabs).The only logical way is to keep track of the tab that was selected last, for every TabGroup.
At the moment, I am doing this:
- In the TabGroup (TabControl) class, I shadow the SelectedTab property (and return a Tab instead of a TabPage). More importantly, in the property setter, I raise a SelectedTabChanged event:
vb.net
Public Shadows Property SelectedTab As Tab
Get
Return DirectCast(MyBase.SelectedTab, Tab)
[code]....
However, it still doesn't work. I soon figured out why: I am checking that the previously SelectedTab is not the same as the new value in the property setter of the (shadowed) SelectedTab property. I don't raise the event when they were the same, and in this case they were the same (as there is only one tab in the TabGroup!).So, I took that check out, and now it seems to work when I click in the text editor.
So one problem remains: the active tab is not changed when you click on the tab header (and not on the text editor). I am clueless as to how I should handle this... I am once again sure there is a simple fix, but I cannot see it. I can click the tab header, and I'm sure behind the hood it responds to this click, but it never raises it SelectedIndexChanged event because the index didn't change but was set to the same value it already had. I cannot override the SelectedIndex property (so I could skip this check and raise the event anyway even if the value didn't change), and the OnSelectedIndexChanged method is not called, so I cannot use that either...
View 6 Replies
ADVERTISEMENT
May 24, 2011
I have two combo boxes, and four buttons. When the user clicks "Add" on the first combo box, it adds a new item to the combo box with "New" and then lets the user rename that item to something else. That "new" item has to have an array of "answers" that go along with that item in the list. What I'm having trouble figuring out is assigning "answers" to the second combobox for each item in the first combobox and changing the second combobox when selecting an item in the first combobox.
EXAMPLE:
Item 1 - Combobox1
- Item 1 - Combobox2
- Item 2 - Combobox2
[code]....
View 5 Replies
Dec 16, 2009
I want to know if the user clicked on the Ellipse (just the line of nonfilled ellipse)? I don't care if the click inside of it,JUST the LINE. I made a copy of the orgianal rectangle info before drawing it. And then I tried .contains on the mouse click? and that allows me to click everywhere
View 10 Replies
Feb 10, 2011
I am trying to create a quiz application in Visual Basic 2008. I need to be able to store a score value when the player gets a correct answer. When the value is stored a new question set appears. Once the score is calculated I want to be able to show this is in a new form so the value needs to be passed from one form to the other. I'm not entirely sure how to do this but I believe it will incorporate a module.
View 9 Replies
Mar 8, 2010
Suppose i want to draw semi-random ellipses on my form.Is there any way i can check if they get clicked at a later stage?Is there any way of storing the location of individual ellipses and then comparing the mouse-click to my list of locations to see if one was clicked?
I can imagine how it could be done with squares or rectangles, but i dont know how to approach it with ellipses.
Im sure this has been asked before, but i've spent a good while searching around for something i can use and came up emptyhanded.
View 5 Replies
Jun 14, 2011
I have a WPF application that allows users to create questions of all different types which depending on the type will use a textbox,combobox,checkboxes, or radio buttons to allow the user to answer the question after they build some sort of questionnaire. My question is what is the best way to keep track of the answers across all the different controls after the controls are created and the questionnaire is created on the fly. Right now, i'm looping through all the containers and getting the values based on the controlType.
View 1 Replies
Sep 5, 2009
I am trying to keep track of the total number of discounts given (whole numbers) I keep getting .75 after the first discount, and it adds .75 for every trans action after that. I have tried to pick it apart but I just don't see it. You can follow by tracking the comments that relate to the summary. I know that is an Integer but the book has it declared as a decimal so I went with it.
Public Class BookSaleForm
'Declare module level variables
Private QuantitySumInteger, SaleCountInteger As Integer
Private DIscountSumDecimal, DiscountedPriceSumDecimal As Decimal
Const DISCOUNT_RATE_Decimal As Decimal = 0.15D
[Code] .....
View 2 Replies
Feb 15, 2012
I am trying (Push)add data into my stack (length of five) and (Pop)delete from the end of my stack.
I need to know how can:
- Add the elements to the stack with keeping track of adding and deleting from it (adding an element will increment until 5 and deleting would decrement until the stack is empty).
Private Sub Button1Push_Click(sender As System.Object, e As System.EventArgs) Handles Button1Push.Click
Dim Stack(4) As String
[CODE]....
View 4 Replies
Aug 10, 2011
(Currently using VB.NET 2010 Express) I'm trying to make a program, the main of which is file transfer. I'm trying to create a program that will keep files and folders synchronized across multiple client computers. I'm using a File system watcher to trigger events, and Using a simple System.Net.Sockets UDP client transfer (found via google) to transfer commands between it and itself on other computers.
Here's that code (this just sends from one textbox to another over the internet)
Imports System.Net.Sockets
Imports System.Net
Imports System.Text
Dim udpClient As New UdpClient(1024)
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
[Code] .....
By this method, I can rename, move, or delete files. I want to implement file transfer, so that whenever a new file is created, or updated, my program will automatically transfer the file to the other computers and update them there.
View 3 Replies
Jul 4, 2011
I tried this:
If TabControl1.SelectedTab = TabPage2
But it didn't work.
View 2 Replies
Dec 16, 2011
Using VB/VS 2010 and am trying to provide the user with a way to change the color of the control buttons on my main windows form. I'm starting with the button click event that then calls another sub-form (code shown respectively below).
I was testing with DirectCast as I need to deal with a multitude of button controls (i.e., will have more than the two shown below).
I would like to know how to deal with the following:
1. How do I save the BackColor so when the user opens the form for the first time (or any other time thereafter) the color set earlier appears (the default via properties is green).
2. When I click on the button for the first time and change the color it doesn't change until I click the button again.
[Code].....
View 1 Replies
Apr 19, 2011
I need to loop through a gridview to find records that match items in a different table (in SQL). Is the best method to loop through the gridview and call an SQL procedure on every loop to find matching records? Or should I pull the entire sql db into a datatable and query the dataset in my gridview loop?
'find source ID based on make/model/serial No combination.
Dim cSource As New clsSource()
Dim ds As DataSet = cSource.GetSources()
[Code].....
View 2 Replies
Sep 16, 2009
When I create more than one instance of the same form and I call a method on any of these instances, the code only fires on the most recently created instance. Even when I click a button on that form, it executes on the other form. How can I call these and keep them as distinct objects?
For example: if I build Form1 with a public method called ChangeMyColor and a button to call that method. Then in the main app I set MyForm1 = New Form1
and MyForm2 = New Form1, then call MyForm1.ChangeMyColor, the color changes on the second instance. Even if I click that button on the first instance, the color still changes on the second.
View 8 Replies
Feb 17, 2010
I made an application that searches for an text file and copy it toc: est. But when is find multiple files i cant copy it because it will overwrite the file in c: est *.txt.Is there a way i can copy a file and Keep the origional file name?[code]...
View 16 Replies
Jun 21, 2009
I'm a long-time developer but semi-new to Visual Studio .NET and VB.NET. I've been working on an application for months, written in Visual Basic .NET. It's a rewrite of a popular IDE of mine that's originally written in assembly. What I'm trying to do in VB.NET is have multiple TabPage classes that inherit from TabPage, ofcourse, but each having it's own methods for common functions like Cut, Copy, Paste, etc. so that when I call tab.Cut(), the TabPage class for the currently-selected tab is the one used. In each custom TabPage class, I'll have a New instance of the main control that goes in that tab.
I think there would be a problem when I loop through the TabPages since the Foreach routine can only use one object type, as far as I know (TabPage).Currently I have only one custom TabPage class called Page that obviously inherits from TabPage, has additional properties and also methods that allow editing functions for whatever control is selected to be displayed for the tab. For example, when I call the New constructor, I supply the editor type as a parameter: dim tab as New Page(HEX_EDITOR).I have edit controls such as text, syntax editor, hex editor, bitmap editor, HTML editor, HTML browser. This means I get a new instance of all of those controls each time a new Page is added to the TabControl. I'm currently disposing of the unneeded editors depending on which editor is the one needed. The scheme is not preferred but it works great for now as I work on other areas of the IDE.
[Code]...
View 3 Replies
Jan 23, 2011
I can build the tabstrip fine and name it - that part is from what I can see the easy bit.What I want to do is select a tab then create a listbox on that tab, and then pupulate the list box with data.
For this test I am using the event viewer.
The system loades the logs into memory, and then creates however many system logs there are ie application, system security etc etc.
But how the hell do I select one of these tabs then draw a listbox and then address the list box - Ideally the list boxes etc will be created at the time of the tab?[code]...
View 3 Replies
Aug 18, 2010
So here is the situation. I have a button on one of my extjs pages. This button opens a child window as a pop-up. This child window has a .method attribute as well as a .ref attribute, and also a .id. I need the functionality to open another window with the SAME template, everytime I click that button.I was thinking set the childwindow .method property to something like 'getWindow', and the .ref to something like 'newWindow' and then create a javascript function on the backend to look something like this:
var myArray = [];
var count = 0;
function getWindow() {
[code].....
View 2 Replies
Jun 10, 2012
I am trying to display an usercontrol(has several panels one on top of the other panel) on tabpage. I am using below code to achieve this.
[Code]...
View 1 Replies
Jan 8, 2009
I am using System.Windows.Forms.TabPage to store an entire TabPage for later use in My.Settings. Here is a brief description of the application.
I have a TabControl that has 3 tabs. One for user input, another tab for equipment settings, and then a final tab for Oven settings. On the user input tab, if the user de-selects the checkbox for Oven, the oven tab is saved to My.Settings and hidden.
I can then run the application without oven control. After running, lets say the user would like to re-run, this time with the oven. They go back to the input tab and re-select the Oven checkbox. However, the Oven tab doesn't re-appear. When stepping through the code, the is nothing stored in My.Settings for the oven tab page. Why not?
Also, I can open the application, and check, then uncheck the oven checkbox and the tab is hidden, then returns. I can do this all day. However, after running the tab will not return.
View 5 Replies
Dec 14, 2011
What happens here is when I click on anyone of the radio buttons the text box score sets the value to either 0,1,2,3,4 but when I go the next case it goes back to 0 instead of keeping the value. I tried many different techniques while going about this none seem to work.
[Code]...
View 2 Replies
Aug 9, 2011
Let's say I'm trying to have a program that will check for a version.txt file online, and enable the user to download a new version of my .exe.Here is an example of how i get the new version. I apologize for the old syntax, but i just got out of VB6 and am still learning FileStream, etc. Inetconnection is just a function similar to Webclient.DownloadData.
DABytes = InetConnection(Pathy)
Targetfolder = Application.StartupPath & "DA.exe"
foldera = FreeFile()
[code].....
View 1 Replies
Jul 29, 2010
I've never really used the SecureString class before but I've got a requirement in an app to have a user enter a password that will be used later in the application, and I figure SecureString is the most secure way to do this.
I have created a little dialog form where the user will enter their username and password and have set the UseSystemPasswordChar property of the password textbox to True. As I need to keep the password in memory for use later though, I have created a property in my main form that is of type SecureString and when the user enters their password into the dialog window I copy the string from the password box to the SecureString property like so:
vb.net
For i As Integer = 0 To LoginFrm.PasswordBox.TextLength - 1
Me.ConnectionPassword.AppendChar(LoginFrm.PasswordBox.Text(i))
Next
I figured out how to get the original string back when I need to (with only a slight hint from the documentation I might add ), which I do like this:
Dim OriginalString As String = Marshal.PtrToStringBSTR(Marshal.SecureStringToBSTR(Me.ConnectionPassword))
but the problem I have is that I want the user to have the option to edit the password they already entered if they want to. This is a problem because I want to avoid putting the real password back into the password box for security reasons, but then if I just put some random characters in there (just to show that their password has been remembered by the app) and then the user clicks OK on the login diaog form then it will update my ConnectionPassword property and set it to the random characters.
One option would be to set the passwordbox text to something specific each time and then test to see if that is what the text is set to when they click Ok (and if it is then obviously dont update the ConnectionPassword property) but this seems pretty rubbish because its possible (however unlikely) that the user could actually select that word as a password.
Any better suggestions? Perhaps its not worth doing anything at all and just use a normal string as the SecureString is going to have to get converted back to a normal string at some point to be used.
View 8 Replies
Apr 17, 2012
I am retrieving text from a rich edit control in an external application. The text is formatted to look something like this: Output: All is well. I'm retrieving the text using :
[Code]...
View 7 Replies
Feb 20, 2011
In my program I have a tab control with 4 tab pages. In the second tab page there is a lot of controls (about 50! includes buttons, labels, combo boxes, textboxes, option boxes). When user opens the program and want to navigate to tabpage 2 there is about 2-3 second delay showing tabpage. This problem only occur the first time, after that it just shows the page fine. I am not sure what is causing this lag but the program seems buggy and slow to user.
View 2 Replies
Feb 21, 2012
I need to add multiple users to active directory in vb.net what would be my best way to do this? Although i see some dotnet classes for them its hard figuring this out for my first time. Mostly what must i be aware of when trying to add them? Multiple opinions on the matter would be fine but I really just wish to add users with basic information like firstname and lastname and maybe to specific group.
View 8 Replies
Feb 15, 2012
In our VB6 applications, we added a few utility functions for tracking the amount of time spent in a function. We did this to track performance bottlenecks. Basically, how it worked was there were two utility functions:
StartTickCount() and EndTickCount().
You would pass the name of the function in each, and the functions would use a dictionary to get the tick count when StartTickCount() was called, and then subtract the tick count when EndTickCount() was called. This wasn't perfect because it didn't of course take into consideration that calls to get tick count takes time, etc, but basically it worked for our purposes. How to make sure to call StartTickCount() at the beginning of each function and EndTickCount() at each exit point:
Private Function SomeFuction() as String
' indicate the function started
StartTickCount("MyClass.SomeFunction")
' some logic that causes the function to end
[Code] .....
Anyway, is there any functionality built in, either through the VS 2010 debugger or in the System.Reflection namespace, to do something similar in VB.NET? Basically, what I want is to log the number of times each function is called, the total amount to time spent in that function, the average number of seconds spent in that function, and the maximum amount of time spent in a single call in that function.
View 2 Replies
Feb 27, 2010
My program has multiple webbrowser objects, each one in a different tab. How would i go about setting up a button to refresh only the webbrowser on the active tab?
View 1 Replies
Jul 4, 2010
Im using My.Computer.Network.DownloadFile(OnlineLocation, FullLocal) to download a file, how can i check when its done and also i want to track the progess with a progressbar. How do i do this?
View 25 Replies
Nov 22, 2010
I Try so many times to change TabPage Size and Form Size when I shif from One TabPAge to another, This because every TabPAge consist of defrent volume of control which need to enlarge and reduce the size. But I couldn't make it.
View 2 Replies
Jun 2, 2010
winforms .net 3.5 Ultrawingrid 9.2 In my subclass of Ultrawingrid.Ultragrid :
[Code]...
This works fine. But when the grid is dropped on a TabControl tabpage, the ctrl-tab looks very different to the sub above. e.keycode is seen as controlkey {17} I realize that by default cntrl-Tab moves between tabpages. I need to override this behavior. My thought is I probably need a subclass of the tabControl which will pass the keycombo through just as the form does but I confess to being clueless as to how to accomplish that. I tried to override the onkeydown of a tabcontrol subclass and just issuing a return and not and base call to onkeydown if the ctrl-tab combo was pressed but it seemed to see the e.keycode as controlkey as well.
[Code]...
View 1 Replies