简体   繁体   English

我应该使用什么可编辑控件在vb.net应用程序中显示电子表格?

[英]what editable control should i use to display my spreadsheet in a vb.net application?

I have a spreadsheet in excel with three headers: 我在excel中有一个带有三个标题的电子表格:

Project Name 项目名

  • The name of a project i'm working on. 我正在从事的项目的名称。

Requested Role 要求的角色

  • The job title/profession of the project employee. 项目员工的职称/专业。 (example: mechanic, manager, engineer) (例如:机械师,经理,工程师)

Name 名称

  • The name of the employee. 员工姓名。

When i click on the Person's name i want another page or tab (specific to this person) to appear showing details about them such as their name, job title, how long they worked, what project they are doing... etc. (similar to a Facebook profile) 当我单击人员的名字时,我想要另一个页面或选项卡(特定于该人员)出现,显示有关他们的详细信息,例如他们的姓名,职称,他们工作了多长时间,他们在从事什么项目...等(类似到Facebook个人资料)

When i click on the project name i want another page or tab (specific to this project) to appear showing details about it such as the requirements, the deadline, who is currently working on it... etc. 当我单击项目名称时,我希望出现另一个页面或选项卡(特定于该项目),以显示有关该项目的详细信息,例如要求,截止日期,当前正在处理的人...等。

Furthermore, i would like to set up two levels of access: 此外,我想设置两个访问级别:

Managers: 管理人员:

  • People who can add new information but not change or delete existing information 可以添加新信息但不能更改或删除现有信息的人
  • (write-only permissions) (只写权限)

Administrators: 管理员:

  • People who can have full access to all information. 可以完全访问所有信息的人。
  • All highest level of access. 所有最高级别的访问。

I don't know how i would go about displaying and/or organizing so much information in a vb.net application. 我不知道如何在vb.net应用程序中显示和/或组织大量信息。 if anyone could provide some suggestions as to some possible layouts of the GUI it would be greatly appreciated! 如果有人可以提供一些有关GUI可能布局的建议,将不胜感激!

Additional Details: 额外细节:

  • For the specific pages i was thinking of using the tab control but i want it so that i can search through the list of projects or names, select one, and then it brings up the page about it. 对于特定的页面,我一直在考虑使用选项卡控件,但我希望使用它,以便我可以搜索项目或名称列表,选择一个,然后打开有关该页面的页面。

  • The levels of access is the least of my worries... although it is still a worry. 访问级别是我最不用担心的……尽管这仍然令人担忧。


You don't want to store that information in an excel spreadsheet, a database is much, much better. 您不想将这些信息存储在excel电子表格中,数据库要好得多。 For what you've described here I'm going to assume that you have Projects and Employees, and that multiple Employees can work on a project. 对于您在此处描述的内容,我将假设您有项目和员工,并且有多个员工可以从事一个项目。 You'll need a few tables then: 然后,您将需要一些表:

Project
  ProjectSeq    'Int     - unique sequence for this project record
  Name          'String  - name of project
  Descr         'String  - description of project
  ...           'Various - other fields as needed

Employee
  EmployeeSeq   'Int     - unique sequence for this employee record
  Name          'String  - Name of employee
  Title         'String  - Job title of this employee
  IsManager     'Boolean - Is this employee a manager?
  IsAdmin       'Boolean - Is this employee an administrator?
  ...           'Various - other fields as needed

ProjEmpl
  ProjEmplSeq   'Int     - unique sequence for this project-employee record
  ProjSeq       'Int     - link to project record
  EmployeeSeq   'Int     - link to employee record
  ...           'Various - other fields that apply to this project-employee combination

Once you have your tables all set up and populated with data, you'll want to read the data and transfer it to your .NET application. 设置好所有表并填充数据后,您将需要读取数据并将其传输到.NET应用程序。 There are a few ways of doing this, you'll have to decide which works best for your needs. 有几种方法可以做到这一点,您必须决定哪种方法最适合您的需求。 I'm a big fan of DataSets, they always work nicely. 我是DataSet的忠实拥护者,它们始终运行良好。

To fill the grid, you'll need to use a sql statement that fills a datatable from the three tables (I'm using notepad as my IDE, so this may not be exact): 要填充网格,您将需要使用sql语句来填充三个表中的数据表(我使用记事本作为IDE,因此可能不完全正确):

SELECT pe.*, p.Name as ProjName, e.Name as EmplName, e.Title
FROM ProjEmpl pe, Project p, Employee e
WHERE p.ProjectSeq  = pe.ProjectSeq AND
      e.EmployeeSeq = pe.EmployeeSeq

To display the data to the end user, you would use a DataGridView control. 要将数据显示给最终用户,您将使用DataGridView控件。 Set the datagrid.DataSource to use the datatable you just populated and the data should show up. 将datagrid.DataSource设置为使用刚填充的数据表,数据应显示出来。

To display the related Employee & Project information, I'd use a tab control underneath the datagrid. 为了显示相关的员工和项目信息,我将在数据网格下方使用一个选项卡控件。 One tab for Project, and one tab for Employee. 一个选项卡用于Project,一个选项卡用于Employee。 Use individual controls for each field in the table. 对表中的每个字段使用单独的控件。 When the user changes rows in the datagrid, load the related Project and Employee information for that row into two datatables and populate the controls from that. 当用户更改数据网格中的行时,将该行的相关Project和Employee信息加载到两个数据表中,并从中填充控件。

Lastly, to set permissions on the program you'll need to have the employee log onto the application. 最后,要设置该程序的权限,您需要使员工登录到该应用程序。 Once they've logged on you can look them up in the Employee table, find out if they are a manager or an administrator, and set the permissions accordingly. 他们登录后,可以在Employee表中查找它们,找出他们是经理还是管理员,然后相应地设置权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM