How can I disable button press? - vb.net

I'm trying to make some controls just for their view. For example I need a button which remains unpressed when it's pressed, like it seems on visual basic editor. How can I make this button?
Edit: Here is what I want
Before press:
After press:

Just a few possibilites
WinForms: yourButton.Enabled = false
WPF: yourButton.IsHitTextVisible = false
Make a image of a button and place it in your form

Related

How to hide and show group of controls using Panel [duplicate]

I am designing a multipage windows form using panels.
I'm displaying a login form and validating the button click, and want to hide the login panel and show the main panel.
However, when I click the button, the login panel disappears alright, but the main panel does not appear. since there is nothing to display, the form window shrinks to just the minimize/maximize/close buttons.
Here's the code for the button:
private void btn_login_Click(object sender, EventArgs e)
{
if (pwdBox.Text == optopwd)
{
MessageBox.Show("Good Morning!!");
loginpanel.Visible = false;
mainpanel.Visible = true;
}
else MessageBox.Show("Incorrect password!");
pwdBox.Text = "";
}
Please let me know what I have missed/misunderstood. Thanks!
Edit:
Screenshots:
Login Screen:
http://img641.imageshack.us/img641/9310/loginscreenj.jpg
Empty window:
http://img163.imageshack.us/img163/1376/emptyx.jpg
The standard mistake is that you accidentally put the mainpanel inside the loginpanel. So when you make loginpanel invisible, the mainpanel can never become visible. This accident is common in the designer, it won't let you put two panels on top of each other. You fix it with View + (Other Windows) + Document Outline. Drag mainpanel and drop it on the form. You'll have to fix the Location property by editing it in the Properties window instead of moving the panel with the mouse.
An entirely different approach is to use a TabControl. Easy in the designer, you just need to hide the tabs at runtime. Code is here.
Or use two UserControls.
Looks like your for is automatically resizing. There are 2 properties on the form responsible for auto size:
AutoSize = True;
AutoSizeMode = GrowAndShrink;
If you have the above settings then your form would shrink just to control panel (buttons) if there's nothing else to display.
Let me know if that helps.
UPDATED
also... does your control "pwdBox" belong to main panel?
Two suggestions:
Try setting the height attribute to 100%
mainpanel.Height = 100%
If that doesn't work, ensure that the page isn't initializing with mainpanel.visible set to false on a postback.

VB.Net One button to show hidden buttons

I'm a complete noob at this, but does anyone know a simple code that will get hidden buttons to show apon clicking another button?
Thanks!!
In the click event of the button that you want to unhide the other buttons just put
Button1.Visible = True
Button2.Visible = True
Etc.
Replace Button1 with the actual button name.
That’s it

Is there a checkbox-like button in WinRT-XAML

Is there a checkbox-like button in WinRT-XAML?
What I mean, is there a button with an IsPressed (or equiv) property that will remain pressed after the user taps it? Then "unselects" after the user taps it again?
ToggleSwitch is what you're looking for
Yes, its called "Toggle Button" or "Toggle Switch".
For more details refer MSDN : WinRT control List

vb.net hide button text or make image on button cover text

I dynamically create buttons on a form and use the button text as ids so that I can pass that to an SQL query to pull saved data about that button when necessary, but I also use an image over buttons that have information saved about them. What I need to know is how do I keep the text on the button from appearing when there is an image assigned to that button? By default vb.net shows both the text and the image and no TextImageRelation values allow for the image to take precedence. I tried changing the text color to transparent, but the outline of the text is still visible through the image. Is there anyway to keep the text value as it is but just show the image on the button?
Don't use the .Text property of the button to store your information. Use the .Tag property for your IDs. Just set the .Text property to "" (empty string), that way it won't interfere with your image.
not sure, but why not just set the value to a variable to be passed to the SQL on the button click event and not place the text on the button? If you are using the same button click event for several buttons you could check the sender's ID and then set the variable based on that.
To Enable "Button1" Click (Visible)
Button1.Enable = True
To Disable "Button1" Click (Visible)
Button1.Enable = False
Hide "Button"
Button1.Visible = True
or
Button1.Show()
Show "Button"
Button1.Visible = False
or
Button1.Hide()
You can Also Used the code to any Tools (TextBox, Label, ComboBox, Radio Button, Button, Link, GroupBox)

making a thumbnail toolbar (windowsAPICodePack,windows 7) button invisible in vb.net

I'm trying to make a thumbnail toolbar button (TTB from now on)visible when the it is clicked. I know how to do stuff when it is clicked, AddHandler etc. But if I tell it TTB.visible=false then it doesn't become invisible. If I put TTB.enabled = False it will be disabled, so it's only the visible that isn't working.
Also I put a button on my form (not a TTB) and when that is click wrote, TTB.visible = false and that didn't work, so there is no way to make it invisible.
Try set TTB.visible=true after you Add it into toolbar button list.