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 }); }
To maintain or store files on our systems, we may need to create subdirectory within a directory. Now,let's see how to create a sub directory within an existing directory. Perform the following steps to create a subdirectory within an existing directory.
Complete code of How to create sub directory
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication2
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string dirpath = textBox1.Text;
DirectoryInfo dirinfo = new DirectoryInfo(dirpath);
string newsub = textBox2.Text;
dirinfo.CreateSubdirectory(newsub);
label3.Text = "your subdirectory " + newsub + " is created at " + dirpath;
}
}
}
Output
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication2
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string dirpath = textBox1.Text;
DirectoryInfo dirinfo = new DirectoryInfo(dirpath);
string newsub = textBox2.Text;
dirinfo.CreateSubdirectory(newsub);
label3.Text = "your subdirectory " + newsub + " is created at " + dirpath;
}
}
}
Comments
Post a Comment