954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Customizing VS DataSource object's control type

Hi, I have a class object that I have created a DataSource on.
e.g.:

public class TestDataSource
{
    string fld1;

    public string Field1
    {
        get { return fld1; }
        set { fld1 = value; }
    }
}


When the DataSource object is created via the wizard, it will create a TextBox for "Field1", by default, that can then be dragged onto a form. Above example is only a working example, because I use many more defined fields.

One of the fields is intended to be a read only HTML Link that it is autogenerated/parsed from the text of another field. This is how I would like it to be displayed and function--to function like a LinkLabel control.

Problem or goal is that I would like to either:
1) customize the property of the Field1 to force the DataSource created by the wizard to be LinkLabel; or,
2) modify the field's default TextBox control to act similar to a LinkLabel without recreating the control; or,
3) if I must recreate the control as a LinkLabel control, determine how I would restore the binding it already has (as a TextBox) with my BindingSource object

Your help is appreciated--thanks!

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 

>When the DataSource object is created via the wizard, it will create a TextBox for "Field1", .
Which application are you talking about - web or desktop?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 
>When the DataSource object is created via the wizard, it will create a TextBox for "Field1", . Which application are you talking about - web or desktop?


desktop application

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

I started browsing the first document, which seems enlightening. I will continue looking into this tomorrow because I'm too tired to play with it right now. Thanks!

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 
Online pages from Data.Binding.with.Windows.Forms.2.0 http://dotnet-forms.info/Addison.Wesley-Data.Binding.with.Windows.Forms.2.0-Programming.Smart.Client.Data.Applications.with..NET/032126892X/ch05lev1sec11.html and The Lightning Framework for Smart Client


I looked into these documents, which refer .xsc files generated by the wizard, but I don't have any of these files. Only the top level file is generated (e.g. TestDataSource.DataSource). The reference indicates that "if the data source is a typed data set definition," then I should see these .xsc files, but I cannot find information related to ensuring my data set definition is "typed" per say.

I believe there might be some information I could provide above my property inside of square brackets (e.g. [COLUMN=...] or something), but I don't know where to find information on manually using these definitions either. I don't know if that is what it is expecting either though.

Any more thoughts?

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 

The .xsc file belongs to your DataSet and not the individual DataSource, i.e. you can have 1 DataSet but 30 DataSources that reference the single typed DataSet.

You're fighting a losing battle with the IDE generated DataSets. I don't use them for this reason :)

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 
The .xsc file belongs to your DataSet and not the individual DataSource, i.e. you can have 1 DataSet but 30 DataSources that reference the single typed DataSet.


But, shouldn't I have an .xsc file generated somewhere? I've searched my entire project folder (all of solution) and I don't have one.

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 

Do you have a typed dataset in your project? Add -- New -- dataset?

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 
Do you have a typed dataset in your project? Add -- New -- dataset?


I did not. I will play with that and see what happens--thanks.

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 

I cannot find any way to tie my existing DataSource object into the DataSet I created. So, I tried recreating my object table by adding data columns to the DataSet, but I can't figure out a way to bind a LinkLabel control to the data column. So, I'm back where I started.

Maybe there is no way to do what I am trying to do?

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 
Online pages from Data.Binding.with.Windows.Forms.2.0 http://dotnet-forms.info/Addison.Wesley-Data.Binding.with.Windows.Forms.2.0-Programming.Smart.Client.Data.Applications.with..NET/032126892X/ch05lev1sec11.html and The Lightning Framework for Smart Client


After looking into the second link you sent some more, I found control types already available for my field object, one of them being the LinkLabel I wanted. I sort of got tunnel vision with the first link, and didn't peruse the second link deep enough. I don't know why I couldn't see these other controls available before, but it was reading deeper into that second link's document that I decided to give it some more time. Anyway, thanks adatapost! I'll mark this resolved as soon as I figure out how--:)

DdoubleD
Posting Shark
996 posts since Jul 2009
Reputation Points: 341
Solved Threads: 233
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You