Click here to Skip to main content
15,891,909 members
Everything / Buttons

Buttons

buttons

Great Reads

by Shai Raiten
In my previous posts about Kinect I've showed how to get started, how to change Angles and more cool stuff, but now it's time to start working on the real things, how to enable Kinect to your environment, I'm talking about PC.
by Издислав Издиславов
Showcase for simple techniques for XAML button styling
by _Noctis_
Quick tip for forms/windows/views where save/insert/cancel buttons are used
by ASP.NET Community
The RadioButton server control creates a radio button on the Web Forms page. Specify the text to display in the control by setting Text property. The

Latest Articles

by Christ Kennedy
In this article, you will learn about a word-processor that makes use of multiple dictionaries, pop-up definitions and an interactive multi-button picturebox expedited with a swift Sweep And Prune algorithm.
by Издислав Издиславов
Showcase for simple techniques for XAML button styling
by Stephen Hesterman
Turn off social media buttons on a mobile device for faster page loading
by DrABELL
Pure HTML5 modal pop-up box ("darkbox") implemented via CSS 3

All Articles

Sort by Score

Buttons 

24 Jul 2011 by Shai Raiten
In my previous posts about Kinect I've showed how to get started, how to change Angles and more cool stuff, but now it's time to start working on the real things, how to enable Kinect to your environment, I'm talking about PC.
7 Aug 2013 by Punamchand Dhuppad
You can Apply this style to your "Play" button..
5 Nov 2010 by shakil0304003
You can read this linksClickClick
6 Sep 2020 by Издислав Издиславов
Showcase for simple techniques for XAML button styling
13 Jan 2012 by Richard MacCutchan
You are using the wrong value to create the new font, you should be using the SelectionFont.Size like this: fontsize = richTextBox1.SelectionFont.Size + 1;
10 Sep 2013 by ridoy
Try something like:btnQuestionNum.Click += (sender, e) => { MyHandler(sender, e, i); }; void MyHandler(object sender, EventArgs e, int i){ //use int i here}I just show you an example how it could be done,hope you should understand what to do.
7 Dec 2009 by Pete O'Hanlon
I would look at using the KeyPress event on the textbox and set e.Handled=true if the key was a spacebar (e is the KeyPressEventArgs for the event handler). Your code might look something like this:private void TextBox1_KeyPress(object sender, KeyPressEventArgs e){ e.Handled = e.KeyChar ==...
7 Dec 2009 by jasonpang2011
To add onto the answer above, the KeyPress event handler won't work unless you set KeyPreview to true. The KeyPreview property is on the Windows Form (click your form, look to the property box to the right, find KeyPreview, and set it to True). Or you can manually add the following to the...
7 Dec 2009 by AspDotNetDev
VB does not use a double equal sign to test for equality. It only uses a single equal sign. Try:e.Handled = (e.KeyChar = " ")Also, it doesn't use semicolons to end lines.
11 May 2010 by «_Superman_»
There are some example articles here on CP -http://www.codeproject.com/KB/buttons/roundbuttons.aspx[^]http://www.codeproject.com/KB/buttons/CRoundButton2.aspx[^]
19 May 2010 by Henry Minute
You need to identify which button sent the message in order to change the colour of only that button. You do that by casting the sender parameter to Button, something like: public void single_button_Click(object sender, EventArgs e) { Button btn = (Button)sender; if...
8 Oct 2010 by lukeer
Hi experts,I'm trying to give some buttons a nice look. In fact, I got the look from some designers as .png image and am now trying to get them to work on those buttons.The images do not completely fill a rectangular space. Instead, the corners are left transparent.I subclassed a...
1 Mar 2011 by Amit Kumar Tiwari
Please see thishttp://msdn.microsoft.com/en-us/library/ms172532.aspx#Y268[^]
19 Mar 2011 by Khaleel-Ahmed
There are 2 ways to solve ur problem..1) Method First:(a)U should change the Property of "Save" Button to enable false at the time of form load event (or set the "Save" Button enable property to False at design time from the property window in VB 6.0)(b) Then enable the "Save" Button...
1 Apr 2011 by BobJanova
When you start from scratch by inheriting Control (or UserControl) you need to do everything yourself, including painting the text. You are not painting text in your paint handler, so no text appears. Add a line including g.DrawString in your paint handler.Correctly re-implementing a button...
2 Jul 2012 by Wes Aday
I am going to take this a step further. I think that your problem is much worse than what Sergey indicates. Let's break down what it is that you are doing:LinkButton btnFile = new LinkButton(); for (int i = 0; i
23 Aug 2012 by avi newman
Try setting the property like so:this.myButton.FlatAppearance.BorderSize = 0;
1 Feb 2013 by OriginalGriff
Create a integer variable at class level, set it to one.Every time you click the button, check the value of the variable and if it is greater than the number of images, set it back to 1.Show that image number.Increment the variable for next time.
15 Sep 2013 by Zoltán Zörgő
Check this: http://stackoverflow.com/questions/3419159/how-to-get-all-child-controls-of-a-windows-forms-form-of-a-specific-type-button#answer-3426721[^]The sample given is returning textboxes, but of course you can use it to get all buttons instead. Simply iterate and change that property -...
29 Oct 2013 by OriginalGriff
There are a couple of ways, but the easiest way is probably just to use a For Each loop on the Form.Controls collection. Of you examine each control and check if it is a button, it's a simple matter to enable / disable all of them without referencing the names at all."Can you provide me a...
27 Feb 2014 by Maciej Los
How do i write ...?There is only one answer: start writing ;)Have a look here: TabControl Class[^]. More samples you'll find here[^].
16 Mar 2014 by Sergey Alexandrovich Kryukov
Bill explained one way of solving such problems; this way can certainly work. However, it will require using raw Windows API, which in turn, will require the use of P/Invoke and badly compromise platform compatibility of your application. So, my first and and main advice would be: consider...
24 Sep 2014 by Suraj Sahoo | Coding Passion
check this fiddle [^]check the above fiddle. You will get the solution I hope.Thanks:)
29 Dec 2014 by Agent__007
Adding this answer as per the OP's response to my comment above:Did you try Pack URIs[^]?Basically, try either:pack://application:,,,/Images/icon_HMI_NewDeci.pngor/{YourProjectNameHere};component/Images/icon_HMI_NewDeci.pngThat should do the trick.
30 Mar 2016 by Karthik_Mahalingam
for scrolling down to the page when the content is filled on the pageuse window.scrollTo[^]at the end of your javascript function window.scrollTo(0,document.body.scrollHeight);
25 Sep 2017 by an0ther1
There is several ways you could fix this, the simplest is to order your results da = New SqlDataAdapter("Select Item_id, Item_menu_description From tbl_item where Item_Cat = '" & lbl & "' order by btnName", cn) You will run into issues if you have more than 9 buttons and use btn1 to btn10 as...
25 Sep 2017 by Patrice T
da = New SqlDataAdapter("Select Item_id, Item_menu_description From tbl_item where Item_Cat = " & lbl & "", cn) Not a solution to your question, but another problem you have. Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door...
30 Aug 2023 by Richard MacCutchan
Using AI is largely a waste of time to solve programming issues, or research "how to" questions. Microsoft provides a comprehensive set of documentation that you should make use of. Using ShellExecute runs the search in a separate Window. So...
15 Sep 2010 by E.F. Nijboer
Maybe this is something for youCustom Button with Color and Shape[^]Good luck!
20 Sep 2010 by Abhinav S
You can have a look at this [^] article. This explains how to simply animations for the pressed state of a button.
2 Nov 2010 by Hiren solanki
        ......
4 Nov 2010 by AngelLoose
Horizontal and vertical both in the middle.
4 Nov 2010 by E.F. Nijboer
You can place a dic around your linkbutton to add the desired style, like this: Good luck!
11 Dec 2010 by Rajitha Wimalasooriya
You can use the Javascript setTimeout() function.Implement a new finction using the setTimeout() function.function goDimAfterTimeout(){ setTimeout("goDim('groovyform','groovybtn1')", 10000);}And call it in the OnClick event.
11 Feb 2011 by Wayne Gaylard
You don't say wether you are using custom templates in your application. If so, you need to check your triggers in your default button style and make sure that the IsMouseOver and IsPressed property rtiggers values are set appropriately. If you are'nt using a custom template, each control comes...
1 Mar 2011 by BillW33
There are some nice CodeProject on custom picture buttons. Read the following articles:WinForm ImageButtonOriented Button in Windows FormsCImageTextButton
4 Mar 2011 by Basnta Padhi
Hi All,I am using a Button with FlatStyle = System.Windows.Forms.FlatStyle.Standard. Now the problem is in this I am using an Image which is dancing and button border is also changing on Mouse Enter and Mouse Leave time.I don't know how to fix this problem and also how to make the Button...
19 Mar 2011 by charles henington
Copy this text, then add a class to your project and replace text in class with this method. Once you have done this rebuild your application and open toolbox and you will have a custom button control called myButton that should show towards the top of your tool box drag and drop the control...
25 Mar 2011 by Eugen Podsypalnikov
Try to start here[^] :)
10 Jun 2012 by Zoltán Zörgő
I have googled for it, and it turned out, that border-radius wont work with (some) input elements in IE9. It is a bug in the CSS3 engine or the problem lies in the fact, that these elements in IE are rather API level controls. Other browser developers have rewritten them from the scratch. I have...
18 Jun 2012 by Sergey Alexandrovich Kryukov
Both code in the question and the answer by Mantu are wrong. It should be something like that:int buttonCount = 5;Button[] buttons = new Button[buttonCount];//...int gap = 10; //... some suitable gap between buttonsint currentX = //... some starting positionfor (int index = 0;...
2 Jul 2012 by Sergey Alexandrovich Kryukov
As soon as you can see the button created by this code, the event should fire. I would rather assume that you fail to observe it. I can suggest to check up two things:First, sometimes you create two buttons looking nearly the same way. One button could hide another one or something like...
20 Jul 2012 by Christian Graus
you just make your buttons show an image instead of text. They have properties for that.
31 Jul 2012 by Christian Graus
This is not a real question. You've told us what you want, and acted as if we know how to give you the code you need, and would just do your work for you. A better UI is one button that says subscribe and changes to unsubscribe when you're subscribed. Then you store if the logged in user is...
4 Nov 2012 by manognya kota
Hi,You can use image button or use Css for that buttons.Refer this links for sampleshttp://aspadvice.com/blogs/richc/archive/2005/05/24/2653.aspx[^]http://www.4guysfromrolla.com/webtech/100601-1.shtml[^]ImageButton Control in ASP.NET[^]Hope this helps.
4 Nov 2012 by MT_
It will be more easy to put an image as button if that serves the purpose. If this doesn't fulfill your requirement, then I believe you will have to create your own button control.Creating a Custom Rollover Button in...
13 Dec 2012 by Sergey Alexandrovich Kryukov
Add a button:Button myButton = new Button();//...myButton.Parent = someParent; // where someParent is some container control like Panel or FormSame assomeParent.Controls.Add(myButton);Now, I don't think your question was how to add event. You can only do it in your own class. You...
19 Feb 2013 by Harikamalina
may be the problem is on click-events...check the following way..->goto design of the form->select the the button which is not working->goto properties of that button and select the events->goto click event check the proper event is attached to that button or not..->if there is no...
19 Feb 2013 by OriginalGriff
Check you have the events wired up in the designer.Look at each button in turn, and double click it. Does it go to a new method, or one of the existing ones?If all buttons go to the existing methods, then put a breakpoint on the first line of each, then run your program. Does each button hit...
12 May 2013 by Sergey Alexandrovich Kryukov
Here is how:http://msdn.microsoft.com/en-us/library/system.windows.forms.form.minimizebox.aspx[^],http://msdn.microsoft.com/en-us/library/system.windows.forms.form.minimizebox.aspx[^].But much better way it this: Microsoft Q209354.—SA
12 May 2013 by Pandiaraj_4u
Form have a property like MaximizeBox and MinimizeBox If you set Both as False then it does not appear on the FORMAnother solutionSet FormBorderStyle Property as FixedToolWindow or SizableToolWindow then the Form Shows only the Close ButtonHopes this helps you...
15 Aug 2013 by idenizeni
Just use a SelectParameter in your sqlDatasource1's SelectCommand so it references the selected value of your dropdown list, like so... ConnectionString="" ...
22 Aug 2013 by CodeBlack
Set validation groups to your control as mentioned below : For TextBox1 and Button1 set ValidationGroup="GroupA"For TextBox2 and Button2 set ValidationGroup="GroupB"
24 Aug 2013 by OriginalGriff
Try this: Adding a 'Minimize to tray'-button to a Form's caption bar[^]
31 Aug 2013 by _Sahar
myOnTouchListener = new OnTouchListener() { public boolean onTouch(View v, MotionEvent me){ if (me.getAction() == MotionEvent.ACTION_DOWN){ oldXvalue = me.getX(); oldYvalue = me.getY(); Log.i(myTag, "Action Down " +...
7 Sep 2013 by omid.nazifi
First of all, use a RelativeLayout in your xml file: android:id="@+id/my_relative_layout" android:layout_width="match_parent" android:layout_height="match_parent"> android:id="@+id/image1" ...
9 Oct 2013 by _Noctis_
Quick tip for forms/windows/views where save/insert/cancel buttons are used
31 Oct 2013 by snamyna
Hye..I have 2 pages where I want to pass linkbutton value from iframe to its parent page.Parent Page vb code:Protected Sub...
9 Nov 2013 by Dave Kreskowiak
That's entirely up to your business logic.Since you already know how to disable a button: MyButton.Enabled = false;, enabling it is just a matter of setting the property to true.
6 Jan 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Change your code to... There is no need to check first.value.length >= 1 as keyup Event is fired from that TextBox only.It is working, tested at my end.function SetButtonStatus(sender, target) { if (sender.value.length >= 1) document.getElementById(target).disabled =...
11 Mar 2014 by Grant Weatherston
I have a document, with an ID (which i need). i am wanting to dynamically create a asp:Button control, that when clicked will trigger an event to then navigate the page to another URL with a query string of id= [documentID]so how do i attach data (the documentId) to the dynamically created...
8 May 2014 by pitonyak
Let me restate a few things that I think that you said:1. You know how to write a "slot"2. You have an array of 20 buttons.I assume that you already know how to connect your buttons to your slot that lets you know that a button was clicked. I assume that your real problem is that you...
25 May 2014 by Sergey Alexandrovich Kryukov
Please see my comment to the question and my past answer: Repeat wpf Datagrid data in another window text boxes[^].Please learn some OOP basics, otherwise you are going to too advanced stuff without understanding of fundamentals. Eventually, it may end up with a lot of frustration.—SA
12 May 2015 by F-ES Sitecore
Protected Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles BtnCapture.Click Response.Redirect("NewPage.aspx") End Sub
2 Dec 2015 by Dave Kreskowiak
Your code is not making any sense. This line:sb.AppendLine(string.IsNullOrEmpty(Text) ? node.Text : tag);says if Text (whatever that is, it's not defined in the code snippet you posted) is null or String.Empty, append the node.Text content to the string builder. If Text is not null or empty,...
26 Jul 2016 by Patrice T
General principle:The cash drawer is connected to computer via a port like COM1, and the computer send a signal trough a physical line of the port.The signal to send depend on the port to which it is connected and which port signal it use.Without this knowledge, it is impossible to show...
19 Aug 2016 by Vincent Maverick Durano
Confirmation should be handled at the client-side. Here's a quick example:Suppose that you have this GridView Columns declaration: You could then write a JavaScript...
7 Oct 2016 by OriginalGriff
null is not a good test here - if the cell value is null it's not a button!But even then there is no built in way to disable it: https://msdn.microsoft.com/en-us/library/ms171619(v=vs.110).aspx[^] explains, and shows how to do it.
7 Oct 2016 by manu_dhobale
Please refer How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control[^]
9 Oct 2016 by Member 11476302
here is itthis.button1.disable;
12 Oct 2016 by manu_dhobale
Please referAssign PostBack Trigger (Full PostBack) for LinkButton inside GridView within AJAX UpdatePanel in ASP.Net[^]
18 Oct 2016 by Faran Saleem
Hello guys,Please help me out here.I have a webform and it has got quite a few fields but there is one radio button list "Report" with yes or no.. and it has button generate email. What i want is when the user selects yes and clicks on generate email, an email should be generated and after...
18 Oct 2016 by Animesh Datta
Hello ,If you are using database , then simply store one bool status to check whether button was clicked or not .Suppose ,the button was clicked and you store 'True' in database table. Now , in pageload just check whether the value was 'True' or 'False' . If it is 'True' then disable it...
18 Oct 2016 by Suvendu Shekhar Giri
You may consider following approach-1. Create a table in the database to store the information of whether the email is being already sent or not. Or you can just insert a row with unique info from the context.2. At page load, hit database to see if the email is sent or not and accordingly...
9 Mar 2017 by Jochen Arndt
You are creating a modeless dialog. In this case you must track the state of that dialog. Your existing code can be used as starting point:void CMy3D_Med_ViewerDlg::OnBnClickedShowDicomTag(){ m_DCMTagDlg.Create(IDD_DICOM_Tags, this); m_DCMTagDlg.ShowWindow(SW_SHOW); ...
26 May 2017 by ZurdoDev
If you look at what the code is doing to show it, it is setting a style on the div. So, just do this to your div: and that will start it off hidden.
16 Aug 2017 by Graeme_Grant
The MouseDown and MouseMove events of a control. Here is an example (in C#) that is easy to understand and demonstrates a method: location - Moving a control by dragging it with the mouse in C# - Stack Overflow[^] which translates to: Private MouseDownLocation As Point Private Sub...
29 Nov 2017 by ZurdoDev
There are several easy ways to do this. One would be when your page loads check who the user is and then set the url of the link. Then the link or button can always be the same. Or you could put the logic in the clicking of the button.
8 Aug 2018 by Gerry Schmitz
private int _counter = 0; ... Textbox_One.AppendText( ++_counter.ToString() + DataToSetandGet.Substring(1).Replace("\r", "\r\n"));
16 Dec 2018 by RickZeeland
See answers here: How can I change the background color of a button WinAPI C++ - Stack Overflow[^] And here: how to change color of button in vc++ mfc for vs2008[^] Also see online tutorial here: MFC Button[^]
20 Feb 2019 by F-ES Sitecore
You're only running your check code on the submit click, you need to run it for other events you're interested in such as the textarea or file changing $('#form').submit(function() { return validate(); }); $('#txtarea').keyup(function(){validate();});...
27 Aug 2020 by Sandeep Mewara
I see you have picked code from here: Button with Rounded Edges C#[^] Looking at the code, there are clear segregation for each corner (4 corners of a button) and how to handle it. If you are struggling in removing (not using) code for any...
7 Nov 2020 by Richard MacCutchan
OK, so a longer look at the code reveals that your program is designed to do nothing. 1. The definition of the launcher button: button = Button(root, text = 'Launch TFL App', command = MainMenu, bg = "black", fg = 'white', padx = which calls...
9 Feb 2021 by RickZeeland
See answer here: c# - How can I save application settings in a Windows Forms application? - Stack Overflow[^] Note when you select Application scope the settings will be read-only, so don't select this. Another interesting idea is to save the...
30 Aug 2023 by Dave Kreskowiak
Why would you want to launch an entirely separate process (rundll32) that will not communicate with your app at all? Using the query window will do nothing in your application. You app will never know the user did anything in that window because...
9 Dec 2009 by nGrafix
Thanks for the help,I worked around modifying regular expression (given to me here here) for different textbox, but i could't get what I neeed. I google it, many things found but not for what i want.Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text,...
9 Dec 2009 by AspDotNetDev
Sounds like you want us to make your regular expression for you. What particular trouble are you having creating your regular expression?
6 Dec 2009 by nGrafix
Hi guyz,I wrote a tiny programme in VB.NET using VS.NET 2008 to sort numbers.I take the input of numbers separated by commas from TextBox1.text, play some algorithm then by clicking a button, display the sorted values in TextBox2.text.NOW i want to restrict the numbers to be only 20...
6 Dec 2009 by Ashish Sheth
No need to count the commas.Use Textbox1.Text.Split(',').Length. It gives you the count of the numbers added in the textbox separated by comma.
7 Dec 2009 by sim099
You could do it the reqular expression way:Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text, "^(,?\d+){0,20}$")This would also validate the input, anything other than numbers or commas would return false.
7 Dec 2009 by nGrafix
Hi guys, am back.First i need to thank you for the "regula expression" given to me ealier, it happily solved my problem.:thumbsup:NOW, before sorting an array I get values from TextBox1.Text like(eg. 323,1,65,7,3,999,0,).HOW can i disable the use of spaces in this control to restrict...
27 May 2010 by RakeshSR
I am designing an small MFC application with two property pages attached to a propertySheet. By default the propertySheet has buttons such as NEXT, BACK, FINISH, HELP, CANCEL. What I want to do is adding images to these buttons, does anybody know how it could be done?Thank you.
10 Feb 2010 by Xihadd
Hi,I'm still a student (4th year univ) and I've worked alot with C# but only recently came to know the possibilities of WPF. I've been using WPF for the last month or so now. My interest in WPF is that for developing Applications which can be used on touch screens.My idea for what I'm...
22 Feb 2010 by kngom83
BEGIN_DISPATCH...
22 Feb 2010 by C.Kumarasinghe
Asin the text to SetText PROPERTY..SetText="text"
31 Mar 2010 by Guy Tal
When I press a button I want it to stay in pressed state untill I'll press the button again.How can I do it in C#?Thanks!
31 Mar 2010 by Guy Tal
It works!I used a CheckBox with the Appearance property set to Button and it's exactly what I wanted.But why the size of the button is so small?I can not change the height and the weight of the button? Why?
2 Apr 2010 by Gary Stafford
If you are asking this in regards to web-based solution, then using jQuery would make this fairly easy by switching the button's CSS classes.
1 Apr 2010 by zhonglin.liang
There are many buttons in a dialog. Add thick rectangle border around the button after it is pressed and hide thick rectangle border after the button is pressed again. After I pressed many buttons ,the buttons that is pressed are of thick rectangle border until I pressed them again. How to...
29 May 2010 by vivek.chauhan2009
Hi,can anybody tell me how to implement a close button (cross icon) in a property sheet MFC application? I'm also trying WM_CLOSE message handler but I want yes/no option in close button. Please help me.ThanksVivek chauhan