views:

35

answers:

1

This might be basic question, however I am confused on some .Net Concpets.
I am trying to create a "Data Browser" in VB.net.

  • Similar to a Web Browser however each Tab in the Data Browser is a view of some Data (from a database or flat files) not a webpage.
  • The UI on each Tab is mostly the same.
  • A list Box (showing datatypes, etc), a TextBox (where you can create a filter), and a DataGridView, a DataSource Picker, etc.
  • The only thing that would change on each tab is that there could be a custom "Viewer". In most cases (depending on the datasource), this would be the datagrid, however in other cases it would be a treecontrol.

From reading through the .Net documents, it appears that I need to Create a Custom Control (MyDataBrowser) Consisting of a Panel with all the common Controls (except the viewer). Every time the user says "New Tab", a new tabpage is created and this MyDataBrowser Control is added, The MyDataBrowser control would contain some function that was able to then create the approriate viewer based on the data at hand.

If this is the suggested route, how is the best way to go about creating the MyDataBrowser Control

  • (A) Is this a Custom Control Library?
  • (B) Is this an Inhertited Form?
  • (C) Is this an Inherrited User Control?

I assume that I have to create a .DLL and add as a reference. Any direction on this would be appreciated.

  1. Does the custom Control have its own properties (I would like to save/load these from a configuration file).
  2. Is it possible to add a backgroundworker to this customcontrol?

Thanks.

+3  A: 

You'll want to make a UserControl.

There is a walkthrough on MSDN that covers this in detail- Walkthrough: Authoring a Composite Control with Visual Basic.

That being said, for your specific questions:

  1. Yes. It has its own properties (which you define).
  2. You can add a BackgroundWorker (or multiple ones) to a UserControl.

As for deployment - typically, you'd have this in a class library (which makes a DLL), and reference that within your applications, but that is up to you. The UserControl can also just be added directly to your application.

Reed Copsey
Reed, Thanks for confirming this workflow for me (.net has a lot of concepts that seem to all run together with my limited experience with the libraries). Thanks fo r the link. As a follow-up, in the case that I want to be able to also select/add various DataViewers at Runtime (a class that would be used by the custom control to show the data in various ways). I assume that these would be .dll files, do you have a link to go about creating a .dll for that case? I guess I am getting hung up on how to create a custom .dll in VB.Net and then go about adding/selecting that at runtime
Paul
@Paul: You'd probably make the "DataViewers" each their own ViewModel. These could be in the same DLL, or separate ones, as needed. If you want to make it very dynamic, you might want to look at MEF: http://mef.codeplex.com
Reed Copsey