Automatically import table columns into form design - c#

So far, I found C# on SQL Server impressively easy to develop with (when relying on the IDEs to walk you through completion).
So it comes as no surprise that I expect a feature that may or may not be available with Visual Studio 2010 & SQL Server 2008 Express:
Instead of manually dragging TextBoxes from the ToolBar into the Windows Form, then typing their names, etc. to associate them with a fields/columns in a table... is it possible to tell Visual Studio to automatically populate the form with all columns from a particular table?
If so, how does one accomplishes that?

You need to look at DataBinding to do this easily. Add your database as a new DataSource for your project, then you can drag parts of it to your form.
See here for a tutorial.

Yes it is possible. You may need to explore .Net Reflection a bit, using which you can build dynamic forms application.
Actually there is something similar for Web called LightSwitch (http://msdn.microsoft.com/en-us/vstudio/lightswitch.aspx)

Related

Is there any DataGridView Like control in MFC

I want to create a Database application in MFC by using VS 2010 and i want to know is there any [.NET Winforms] DataGridView Like control in MFC.
You can check this link to see how you can create MFC control from WinForms Control. Also here is the discussion about the issue.
As far as I know there is no built in solution from Microsoft. You will need to roll your own. There are some pre-built solutions but I have never tried them.
https://www.google.com/search?q=MFC+datagrid&aq=f&oq=MFC+datagrid

How does .NET create and execute its Windows, buttons, etc.?

I have been wondering from the first day, when I started to read, how does the .NET Framework work?
First it's really good to have an IDE like Visual Studio. While for example when I click and drop the textboxes, buttons, set their properties and so on, everything works fine.
But in the case of Java in most cases we as a programmers write coding to develop a Frame (window). But in case of .NET, Visual Studio make things easier, but how does work that, without writing a single line of code, all Windows, buttons, etc. are created?
And if I change the button name in the Form design area, where does this get stored, and more importantly how does it get displayed when we execute our program? Is this magic? Or there is a long process under the hood?
There is absolutely no magic behind this. The visual forms designer in Visual Studio generates C# code for you. Just chceck the Form1.designer.cs file.
The code in your .designer.cs is generated by serialization (objects -> code, code -> objects). Look at the CodeDomSerializer class if you wanna try understand better what is happening under the hood (with Reflector you might wanna check ControlCodeDomSerializer in System.Design.dll). And of course you can create your own serializer for custom controls and components.

Creating UI framework more like Visual studio

I want to develop the application UI much like as VS2010 or any similar UI models. My requirements are as below:
Opening new project will create empty canavs.
When I will do add data sheet it will add new tab page in that.
Remaining few things I will do on that added tab page like showing charts, different types of controls etc.
When I will press 'Save' it will persist whatever there on UI like added tab pages and every controls on it on disk.
When I will open any saved project, It will recreate everything what was there on UI at the time of saving the project.
I will have recently open project list.
Any idea for creating how to create such UI?
Thanks,
Omky
Maybe develop your solution over Visual Studio SDK? A good sample is AddonStudio for World of Warcraft which is customized dev. environment for World of Warcraft addon development based on Visual Studio.
It's quite easy to implement the Visual Studio-inspired UI using DevExpress Docking library for WinForms.

Is there a utility that can monitor open windows/ in .net winforms?

This is a general question, but I'll explain my specific need at the moment:
I want to find the framework class that enables one to choose an image at design-time. I can find the editor that is used at run-time - its the Drawing.Design.ImageEditor. At design time, however, a different editor pops up which allows one to choose an image from resources.
I'm guessing I could run some kind of program, then open up the image editor, from the property grid, and see what new windows/classes have been created?
Thanks
Yes, you can see what's being used by using another instance of Visual Studio and use Tools + Attach to Process (managed) to look at the call stack. It is a Microsoft.VisualStudio.Windows.Forms.ResourcePickerDialog. That is not something you can use in your own code, the Visual Studio designer assemblies are not re-distributable. Nor would they be useful, they monkey with the design-time state of the project.
Making you own isn't that hard, just use Reflection to iterate the properties of Properties.Resources and find the ones that have the Bitmap or Icon type. Display them in a ListView to allow the user to pick one. Adding resources at runtime isn't an option.
A tool with similar functionality to what you mention is Spy++ which you can find in your Visual Studio folder on the start menu (under the sub menu Visual Studio Tools).
However, if I understand you correctly, I don't think the design time editor you're talking about is written in managed code and even if it was, I'm fairly sure it's not in the framework. It's just part of Visual Studio itself and as far as I know you can't get hold of the source code for that.

Advanced GUI and database in c#

Do you have any idea how to present all rows from let's say table with the possibility to click on particular row and open that way another window to edit?
I've got no idea how to create this. I would like to avoid access like creation by built-in wizards in Microsoft Visual Studio 2008.
Perhaps you know where I can find more information.
Execute a query which retrieves an overview of the records that you want to display.
When you double-click a row, you retrieve the records that represent that entity, and display it in another window...
That's in a nutshell how you could do it.
For a web application you may want to look at this Walkthrough as MSDN. You can find a winform walkthrough at MSDN as well. Though you say that you prefer doing it without the designers, I suggest that you go through the walkthrough using the designer and look at the code that it produces as a sample of how you could do it by hand. You could then adapt the example as needed for your purposes. For more references try googling "master detail view."
well i would use wpf with a stackpanel of listboxes
the rows are dynamically added to the stackpanel.
the listboxes contain textfields that are databind -ed to mouseclickevents and onchanged events.
http://dotnetslackers.com/articles/silverlight/WPFTutorial.aspx

Categories

Resources