PC Review


Reply
Thread Tools Rate Thread

DataBinding objects in the Designer/GUI

 
 
dev@fwcjua.com
Guest
Posts: n/a
 
      26th Jul 2006
Hi everyone, Is there a way to bind a control (TextBox) to an untyped
public DataSet on a WinForm and have its columns appear in the designer
under "databindings"? For example, in pseudo-code:

public DataSet myDataSet = null; // could be exposed as a property
(...)

Form_Load(...)
myDataSet = AnotherClass.GetDataSet(primaryKey);

// All databindings are set in the designer

myDataSetBindingSource.DataSource = myDataSet; // Example

I'd be willing to describe the schema in "myDataSetBindingSource" or in
a drag-and-drop DataSet, etc, but I think setting the bindings in code
isn't the way it's done- I'm not stuck on using the GUI , just want a
standard to follow. Also, when I bind to an object or typed dataset,
where the schema is already exposed, everything works great. Thanks for
any suggestions!

 
Reply With Quote
 
 
 
 
Frans Bouma [C# MVP]
Guest
Posts: n/a
 
      26th Jul 2006
(E-Mail Removed) wrote:

> Hi everyone, Is there a way to bind a control (TextBox) to an untyped
> public DataSet on a WinForm and have its columns appear in the
> designer under "databindings"? For example, in pseudo-code:
>
> public DataSet myDataSet = null; // could be exposed as a property
> (...)
>
> Form_Load(...)
> myDataSet = AnotherClass.GetDataSet(primaryKey);
>
> // All databindings are set in the designer
>
> myDataSetBindingSource.DataSource = myDataSet; // Example
>
> I'd be willing to describe the schema in "myDataSetBindingSource" or
> in a drag-and-drop DataSet, etc, but I think setting the bindings in
> code isn't the way it's done- I'm not stuck on using the GUI , just
> want a standard to follow. Also, when I bind to an object or typed
> dataset, where the schema is already exposed, everything works great.
> Thanks for any suggestions!


THe designer has to know type information at design time, so it has
to know what columns the tables in the dataset have to give you the
ability to set the textbox' binding to one of these columns. As the
dataset's columns aren't known at design time in the construction
you're working with, you won't get the info at design time and have to
setup the bindings in code.

There's nothing wrong with setting up the bindings in code however.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding expressions are only supported on objects that have a DataBinding event jobs Microsoft ASP .NET 0 26th Sep 2007 12:54 AM
Databinding With Objects Patrick Microsoft C# .NET 5 15th Feb 2007 07:26 AM
databinding and objects tarscher@gmail.com Microsoft ASP .NET 0 11th Oct 2006 04:44 PM
Databinding: Objects within Objects as Properties Aaron Moore via .NET 247 Microsoft Dot NET Framework Forms 0 10th Jun 2004 03:48 PM
Databinding with Nested Objects Victor Jones Microsoft Dot NET Framework Forms 3 30th Oct 2003 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:07 PM.