Hi all i am a newbie in development
I have a window application in vb.net in VS 2003 there is a tabcontrol which has three tab pages.
i want that user was not able to change tabpages by clicking tabcontrol rahter than it is done by clicking button on tabpages how it is possible
please help me
thanks in advance
Report post as abusive
Hold current TabPageIndex in integral variable, and once the click done on any TabPage set the TabControl SelectedIndex = the integral value
tabControl1.SelectedIndex = integral variable;
You can also do it in the event handler of the TabControl.SelectedIndexChanged
I am able to show specific tab page on button click. but i did not want user to change tabpage by clicking on tabcontrol but by clicking button only
I tried one solution but it is not full proof It may cause error in later part
on load event of form i give
dim tab as integer =1
then when user click on tabcontrol then on validating event of tabpage i put the code that
if tab=1 then
so when user click on tabcontrol than tab=1 so the tabpage is not changed
on button click event i used this code
so now tab is not 1 so it will not trap on if else coding of validating event & user will able to change tab page by clicking on button not on clicking tabcontrol because in end of elseif event i again value tab=1
Private Sub Browse_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Browse.Validating If tab = 1 Then (tab is a variable) e.Cancel = True Else End If tab = 1 End Sub
and on button click event
tabcontrol1.selectedtab = browse
I only entered in the programming job since last 2 month. I am working in Publighing house. they have no IT department Or IT staff. They want to develop their data entry program in vb.net & SQL server.
AS i mention i am a newbie no experience of any type. So i develop most of their model window application by taking help og internet & books but here i got in problem
My application is window application for dataentry. It has three tabpages First tab page is filter which is use to specify fitering condition to filter data from database & display that in datagrid present in second tab page browse. oN BROWSE TABPAGE i can present that data in excel format & also in crystal report.
then there is third tabpage ADDEDIT. On which ican edit the record or add new record. Tell me how u think about my approach to develop that application. Any suggesion help or improvement in any aspect will welcom & must be appriciated
Now coming on current problem
As there is no selecting event in VS 2003 So what u think about using IMessageFilter.PreFilterMessage
function & trap the click event od tabcontrol. I dont know how to use that function.
please tell me is that function is useful in this scenerio & if yes than please tell me any link to use IMessageFilter.PreFilterMessage function to capture click event of tabcontrol
again thanks all for ur support & help
Tab-control is supposed to work by user selecting any tab he or she wants to and in any order he/she wants to select it. This is not to say that your approach is "wrong".
But like you noticed you ended up thinking about using IMessageFilter.PreFilterMessage. If your not familiar with programming that will lead you in a deep s**t.
Another way to do it, would be to use three overlapping GroupBox controls in a form. One for each stage your prog currently is in and setting Visible-property according to which "page" you want to show. Of course, the "Next Page"-button is in the form outside of any of the groupboxes.
Inside the first groupbox you set all the controls needed for the filter and so on. After you've built all three groupboxes, drag (or copy/paste) them over each other. Use a global variable to hold the stage of your prog, like Page = 1 and set first gb visible and hide other boxes. After the user presses "next"-button, increase Page variable and set visible properties for the groupboxes so that only the second gb is visible.
I don't have VB2003 but it should work just fine. I've done similar thing with VB6 so I don't see any reason why it wouldn't work in VB2003.
thanks for reply i am understanding ur suggetion. But my project is completed in all respect & this is the shortcoming tell by my boss not allow user to click tabcontrol(its not my idea) I know what is the use of tabcontrol if user is not allowed to click & select tabpages of his choice so i have to make change on current project itself
please tell any suggetion idea or method
by the way thanks all of u for ur effort
By the buttons have properties Enable = TRUE or
Here's a code that should be compatible with VB2003/.NET 1.1
Private TabIX As Integer Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' TabIX = 0 End Sub Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged ' TabControl1.SelectedTab = TabControl1.TabPages.Item(TabIX) End Sub Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' If TabIX < TabControl1.TabPages.Count - 1 Then TabIX = TabIX + 1 TabControl1.SelectedTab = TabControl1.TabPages.Item(TabIX) End If End Sub
and put the "Next Page"-button in the form outside of the tab control. If your "Next Page"-buttons resides in tab pages i.e. you have more than one "Next Page"-button then you can use the same event handler for them: Handles Button1.Click, Button2.Click, Button3.Click
I have solved the problem & if any body need that so iam posting code below
I declare a global variable tab & assign its value tab=1 on form's load event & on tabcontrol selectedindexchanged event use
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
TabControl1.TabPages(TabControl1.SelectedIndex).CausesValidation = True
on validating event of tabpages
Private Sub Filter_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Filter.Validating
If tab = 1 Then
e.Cancel = True
enter event of tabpages
Private Sub Filter_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Filter.Enter
tab = 1
because validating event fires on when tabpage is selected
so use textbox1.select()
now on closing event of from i used
e.cancel = false
& to able to change tabpages on button click I used on button click event
because now it escapes from if else loop of validating event of tabpage
In end thanks all of u for ur help
You're welcome, please mark this thread as solved to be used as reference for such question later :)
hi all , i search for motion detector documents and code source with systemC programming language, any help pls
I'm currently working on multithreading with PyAudio and Pygame, but when I try to run the audio, I get an error saying "OSError: [Errno -9996] Invalid output device (no default ...
My question is not so simple:
I have a WindowsForm with a diffrent controls like: textboxes, comboboxes, checkboxes, datetimepickers, listview and so on...
How can i create temporary data ...