Related Articles
Mar 3, 2018 - This java example shows how to enable or disable JTextField using Java Swing JTextField class.
- 1 Use Radio Buttons in Excel
- 2 Put a Data Table Value in a Text Box
- 3 Turn on Worksheet Gridlines & Row Headings Using VBA in Excel 2003
- 4 Add Database Records Using Java in NetBeans
Use Word’s check boxes to gather data from someone reading your document or from someone using a VBA program you've embedded in the document (VBA is short for Visual Basic for Applications, a programming language developed by Microsoft). The data should be of a Boolean nature, meaning it can only take one of two values. To use check boxes, write VBA macros for them in an event procedure within the VBA development environment. Event procedures are functions that run when certain events occur in a Word document. One such event is a user clicking a check box.
Use Check Boxes on a Document Page
1.Create a new Word document, then click the “File” menu. Click “Options” to display the Options dialog box. Click 'Customize Ribbon' in the dialog’s left pane, then click the 'Developer' check box. This tells Word that you want to reveal the normally hidden Developer tab. This tab has a button that lets you insert check boxes in Word documents.
2.Click the 'Developer' tab, then click the 'Legacy Tools' button in the Controls group. Click the check box control to insert a check box into the current document. Right-click on the check box and click 'Properties.'
3.Click in the text box to the right of the Caption property in the Properties pane, then type the prompt you want the user to respond to by clicking the check box. For example, you could type “Yes, please sign me up for the newsletter.”
4.Right-click the check box and click 'View Code' to open the VBA development environment. Type the following VBA statements above the End Sub statement. These statements display a message if the user ticks the check box.
If (Check box1.Value = True) Then MsgBox ('You've subscribed') End If
5.Press 'Alt-F11' to return to the Word document, then click the 'Design' button in the Controls group of the Developer tab. This action activates the check box for data entry.
6.Click the check box. Your macro will run and display the message “You’ve subscribed.” Click the check box again to remove the check mark. No message displays this time.
Use a Check Box in a Userform
1.Create a new Word document, then press 'Alt-F11' to enter the VBA development environment. Click the 'Insert' menu, and then click 'Userform' to insert a new userform into the document.
2.Drag a check box control from the Toolbox pane onto the userform. Type a prompt in the text box to the right of the Caption property in the Properties pane, such as “Yes, I’d like to subscribe.”
3.Double-click the check box to display the event procedure that will run when a user clicks the check box during execution of the userform. Type or paste the following program code above the End Sub statement.
If (Check box1.Value = True) Then MsgBox ('You just subscribed.') End If
4.Press “F5” to execute the userform. Click the check box to insert a check mark. Your program code will run and display the message “You just subscribed.” If you click the box again, no message will appear because the If statement in the code only checks for the condition when the check box is ticked.
References (1)
About the Author
Darrin Koltow wrote about computer software until graphics programs reawakened his lifelong passion of becoming a master designer and draftsman. He has now committed to acquiring the training for a position designing characters, creatures and environments for video games, movies and other entertainment media.
Cite this Article Choose Citation Style
Koltow, Darrin. 'How to Use Check Boxes in Word.' Small Business - Chron.com, http://smallbusiness.chron.com/use-check-boxes-word-54673.html. Accessed 24 June 2019.
Koltow, Darrin. (n.d.). How to Use Check Boxes in Word. Small Business - Chron.com. Retrieved from http://smallbusiness.chron.com/use-check-boxes-word-54673.html
Koltow, Darrin. 'How to Use Check Boxes in Word' accessed June 24, 2019. http://smallbusiness.chron.com/use-check-boxes-word-54673.html
Note: Depending on which text editor you're pasting into, you might have to add the italics to the site name.
![Kodingan Checkbox Java Kodingan Checkbox Java](/uploads/1/2/5/3/125318647/432617208.png)
The following example explains how to use Multiple Checkboxes in forms using the Spring Web MVC framework. To start with, let us have a working Eclipse IDE in place and stick to the following steps to develop a Dynamic Form based Web Application using the Spring Web Framework.
Step | Description |
---|---|
1 | Create a project with a name HelloWeb under a package com.tutorialspoint as explained in the Spring MVC - Hello World chapter. |
2 | Create Java classes User, UserController under the com.tutorialspointpackage. |
3 | Create view files user.jsp, users.jsp under the jsp sub-folder. |
4 | The final step is to create the content of the source and configuration files and export the application as explained below. |
User.java
UserController.java
Here, for the first service method user(), we have passed a blank User object in the ModelAndView object with name 'command', because the spring framework expects an object with name 'command', if you are using <form:form> tags in your JSP file. So, when the user() method is called, it returns the user.jsp view.
The second service method addUser() will be called against a POST method on the HelloWeb/addUser URL. You will prepare your model object based on the submitted information. Finally, the 'users' view will be returned from the service method, which will result in rendering the users.jsp
user.jsp
Here, we are using <form:checkboxes /> tag to render HTML checkboxes.
It will render following HTML content.
users.jsp
Once you are done with creating source and configuration files, export your application. Right click on your application, use Export → WAR File option and save your HelloWeb.war file in Tomcat's webapps folder.
Now, start the Tomcat server and make sure you are able to access other webpages from webapps folder using a standard browser. Try a URL http://localhost:8080/HelloWeb/user and we will see the following screen if everything is fine with the Spring Web Application.
After submitting the required information, click on the submit button to submit the form. We will see the following screen, if everything is fine with your Spring Web Application.