This question already has answers here:
Hiding and Showing TabPages in tabControl
(21 answers)
Closed 6 years ago.
I'm programming a windows application program, using winforms c#
I have a tab control that contains so many pages I need to hide some of these tabs from non-admin users,
for example
if user is an admin no pages will be hided, else page number 1 and 2 will be hided and other pages will be shown,
I don't want to remove pages, just hide because in the program I made you can sign out without closing the program and sign in again as an admin
Please have a look at this thread.
As amazedsaint said:
Visiblity property has not been implemented on the Tabpages, and there is no Insert method also.
You need to manually insert and remove tab pages.
Here is a work around for the same.
http://www.dotnetspider.com/resources/18344-Hiding-Showing-Tabpages-Tabcontrol.aspx
No way to hide it ,you will have to remove pages an re add them for admin user
tabControl.TabPages.Remove(tabPage);
tabControl.TabPages.Add(tabPage);
As seen here you can however disable/enable tabs. While this won't make then invisible, you can restrict access. That should get you going in a workable direction.
I'd personally also put all the restricted tabs at the end, but that's just a point of personal taste.
Related
I have around 11 section in my tab every section have around 50 question, then total all question will be around 550 question. There two users will access this tab, one user will see all question and they will submit details of all sections and another user will see some questions around 200 question from each section.
My question is how to hide the questions to another user will have some questions access and i am user asp.net control in all 11 sections but i am not getting any best approach to hide the question to another user.
below is my sample tab section
When I click Case 1 section then case1.aspx page will appear with 50 question to full access user and another user will have 20 question access only in case1.
and this is not jquery tabs using user control doing this. My question is how to hide 30 question for another user in case1 section, i am planing to used asp panel to hide 30 questions in case similarly in other sections. This is correct way to hide question. any other simple trick also there?
Because in case 1 section another user can see question number 1 to 10 and 40 to 50 and total 20 question. If i will used asp panel then question number sequence problem also coming to me like 1,2,3,4,5,6,7,8,9,10,40,41,42...50. And the sequence should be 1,2, ....20. Please tell me i have to use asp.net panels or not, if not please tell be best trick.
Hiding the answers is not a proper solution because a user could see the data by just removing the display none property in HTML.
you should remove the desired questions from the data source you are passing to control after checking the user permission whether to show these questions or not
This could be one solution.
This question already has answers here:
How do I find out which control has focus in .NET Windows Forms?
(7 answers)
Closed 6 years ago.
I'm having trouble figuring out how to get c# to get the focused element within a window. I've a window of another program with two text boxes, a dropdown, and two buttons. I need to be able to open this program, pull it to the front, and fill in the two text boxes and select from the dropdown programatically.
I can pull the window forward with SetForegroundWindow and fill things out and navigate about with SendKeys, but since I don't always know which box the cursor will start in, I need to be able to determine where it is once I've pulled it to the front to fill them in properly.
Any ideas?
Going off of memory and pseudocode here.
Inside of a form, you should be able to use this.ActiveControl to get that information, which should provide you with a wealth of other information, such as the name of the control, type, etc.
This question already has answers here:
Window vs Page vs UserControl for WPF navigation?
(5 answers)
Closed 8 years ago.
I wondered if someone could help me. I'm new to WPF and am currently writing a desktop application, but I cannot seem to get my head around what to use when redirecting someone to a new section of the application.
My options appear to be
Window
Page
UserControl
but I don't understand what the difference between them is, and when I should use each one.
Could someone explain the differences for me, and give an example of what situations/applications you may use each one for?
I'm not sure there is a right answer here, but let me try and guide you. The Window class was created to allow you to have a true window. So, if you need to open a dialog, put it in a Window. Generally you will have at least one Window to house the main form.
A Page was built to be used with the NavigationWindow class. This allows you to build Page classes that are marked up like everything else, but just navigate to them under the covers. This is good if you have a single-paged application where the users just go back and forth between pages (i.e. a wizard).
A UserControl is a way to house reusable markup. These can be housed inside of any ContentControl. These can be swapped out of a "content pane" for example on the main window, like Outlook.
Using that, I hope it helps guide you in the right direction on when to use which. They each have their own uses and are not necessarily exclusive.
This question already has answers here:
Custom button captions in .NET messagebox?
(8 answers)
Closed 9 years ago.
I've a winform application, and we are trying to make it ergonomic as possible, so we respect a lot microsoft guidelines.
We have some "Deletion confirmation" to implement, and according the guidelines and what I found accross the web, the more adequate buttons would be:
Delete and Cancel
But since we use the MessageBoxButtons to specify which buttons we have to display, I can't see how we can do this except implementing ourself a confirmation dialog.
I don't find very logical that microsoft encourage in one side the use of "action" text on button, and the other side doesn't give us the tools to be compliant, so I think I'm missing something?
Please note that I don't need more results possibility than currently, My Delete option would be the same as Ok for me, I just want to have differents texts.
So: Is there a way to specify easily buttons we want to show different text here?
There is no easy way other than creating your own implementation using form and show it as dialog?
We did the same some time back because of localization specialities in our project.
This question already has answers here:
Creating Wizards for Windows Forms in C#
(3 answers)
Closed 9 years ago.
How do you make something like the things where you install programs by clicking the "Next" button and it will show you like a TextBox instead of a ComboBox like on a new Panel?
Sort of like changing Tabs on a TabControl but without showing the tabs.
You are probably looking for Wizard. You may see
Simple Wizard for Winforms - CodeProject
You may also take a look at WinForms Wizard from DevExpress but its not free.