I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
NumericUpDown
control is used when user want some numeric values as input or to show some
numeric values to user. It has some properties which are mostly used about this control are:
- Increment: this property indicates amount to increment or decrements on each button click.
- Minimum: indicates minimum value for this control.
- Maximum: indicates maximum value for this control.
- Value: indicates current value of this control.
Most
often NumericUpDown control in windows form displays a single numeric value
that can be incremented and decremented by clicking up and down buttons on the
control.
We can
extend this control so that user can enter time using NumericUpDown.
To do
this we use two NumericUpDown control in our form, one for inserting hour and
one for minutes.
In our
Form1.cs (Designer file) drag and drop two NumericUpDown controls and a button from
ToolBox. Button will used to show the selected time through its click event.
Now for first NumericUpDown control set- Increment = 1
- Minimum = 1
- Maximum = 24
- Value = 1
And for
second NumericUpDown control
- Increment = 1
- Minimum = 1
- Maximum = 24
- Value = 1
In
click event of button write following code:
when we run our project and set some values in both numericUpDown control and click on button it will show a message box like:
Finally we have used these controls as time control.
Download source code.
Comments
Post a Comment