|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataSource/DataBindHi,
This question probably went back a couple of times, but I didn't find anything about it on google, so I ask here... What is the best way to use the DataSource/DataBind pattern in a class? I would like the user to be able to set a data source and I'd like my class to be able to use this datasource to build a DataTable I could use for further processing... Can it be done? if it can, how? Thanks ThunderMusic Thundermusic,
What has that class to do? Cor Show quote "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... > Hi, > This question probably went back a couple of times, but I didn't find > anything about it on google, so I ask here... > > What is the best way to use the DataSource/DataBind pattern in a class? I > would like the user to be able to set a data source and I'd like my class > to be able to use this datasource to build a DataTable I could use for > further processing... > > Can it be done? if it can, how? > > Thanks > > ThunderMusic > I don't really understand what the purpose of the processing has to do with
how to set a datasource and converting it to a DataTable, but I don't mind giving a little spoiler on what I'm doing (nobody won't know the overall of the project just by this tiny bit anyway) I must itterate in the rows and find some columns (colums names provided by the user in a property of the object) and display the values of these columns in graphs and charts... I know that most bindable controls can receive Arrays, List, SortedList, Dictionaries, DataTable, DataView, DataSet, et al. All thos controls don't behave the same at all when it comes to retrieve the data, so I don't want my objects to always try to find which object I'm working with... If there's an easy way of doing it, I wanna know... I just don't want to do if (datasource is DataSet) DoSomething; if (datasource is somethingelse) DoSomethingElse; and so on... If I can't do without it, I'll do it, but if I can do without, I'd prefer to do without... ;) and preferably I don't want to inherit from DataBoundControl because I'm not developing a control yet... the Data-Bound object is only a class that will be used in many of my controls... Thanks ThunderMusic "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl...Show quote > Thundermusic, > > What has that class to do? > > Cor > > "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht > news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >> Hi, >> This question probably went back a couple of times, but I didn't find >> anything about it on google, so I ask here... >> >> What is the best way to use the DataSource/DataBind pattern in a class? I >> would like the user to be able to set a data source and I'd like my class >> to be able to use this datasource to build a DataTable I could use for >> further processing... >> >> Can it be done? if it can, how? >> >> Thanks >> >> ThunderMusic >> > > Thundermusic,
In my idea are there only very few controls in WindowForms that can use the datasource. That are the ListControls, the DataGrid and the DataGridView (complex datacontrols) And that distinct them from the other controls which all can all however only be binded using the DataBind. Cor Show quote "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht news:OyYwss9zGHA.4044@TK2MSFTNGP04.phx.gbl... >I don't really understand what the purpose of the processing has to do with >how to set a datasource and converting it to a DataTable, but I don't mind >giving a little spoiler on what I'm doing (nobody won't know the overall of >the project just by this tiny bit anyway) > > I must itterate in the rows and find some columns (colums names provided > by the user in a property of the object) and display the values of these > columns in graphs and charts... > > I know that most bindable controls can receive Arrays, List, SortedList, > Dictionaries, DataTable, DataView, DataSet, et al. All thos controls don't > behave the same at all when it comes to retrieve the data, so I don't want > my objects to always try to find which object I'm working with... If > there's an easy way of doing it, I wanna know... I just don't want to do > if (datasource is DataSet) DoSomething; if (datasource is somethingelse) > DoSomethingElse; and so on... If I can't do without it, I'll do it, but if > I can do without, I'd prefer to do without... ;) and preferably I don't > want to inherit from DataBoundControl because I'm not developing a control > yet... the Data-Bound object is only a class that will be used in many of > my controls... > > Thanks > > ThunderMusic > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de > news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl... >> Thundermusic, >> >> What has that class to do? >> >> Cor >> >> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >> news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >>> Hi, >>> This question probably went back a couple of times, but I didn't find >>> anything about it on google, so I ask here... >>> >>> What is the best way to use the DataSource/DataBind pattern in a class? >>> I would like the user to be able to set a data source and I'd like my >>> class to be able to use this datasource to build a DataTable I could use >>> for further processing... >>> >>> Can it be done? if it can, how? >>> >>> Thanks >>> >>> ThunderMusic >>> >> >> > > Thunder,
I did something similar along what your looking for - ( I think. ) I have created a Class that has a couple properties: Private DBName As String Private TableName As String Private FieldName As String Private FieldType As String Private FieldLength As Integer and to make a long story short it allows me to call a sub that adds this into an array of the class. Setup_AddFields(DBFileName, "VersionTable", "VersionField", "StringType", 4) I then have another sub that loops thru the array and creates the dbfile name if it doesnt exist, then it creates the table if it doesnt exist, and then it adds the field, with the type and length. Is that something that you are looking for ? M. Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23p42p29zGHA.4796@TK2MSFTNGP06.phx.gbl... > Thundermusic, > > In my idea are there only very few controls in WindowForms that can use > the datasource. > > That are the ListControls, the DataGrid and the DataGridView > (complex datacontrols) > > And that distinct them from the other controls which all can all however > only be binded using the DataBind. > > Cor > > > "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht > news:OyYwss9zGHA.4044@TK2MSFTNGP04.phx.gbl... >>I don't really understand what the purpose of the processing has to do >>with how to set a datasource and converting it to a DataTable, but I don't >>mind giving a little spoiler on what I'm doing (nobody won't know the >>overall of the project just by this tiny bit anyway) >> >> I must itterate in the rows and find some columns (colums names provided >> by the user in a property of the object) and display the values of these >> columns in graphs and charts... >> >> I know that most bindable controls can receive Arrays, List, SortedList, >> Dictionaries, DataTable, DataView, DataSet, et al. All thos controls >> don't behave the same at all when it comes to retrieve the data, so I >> don't want my objects to always try to find which object I'm working >> with... If there's an easy way of doing it, I wanna know... I just don't >> want to do if (datasource is DataSet) DoSomething; if (datasource is >> somethingelse) DoSomethingElse; and so on... If I can't do without it, >> I'll do it, but if I can do without, I'd prefer to do without... ;) and >> preferably I don't want to inherit from DataBoundControl because I'm not >> developing a control yet... the Data-Bound object is only a class that >> will be used in many of my controls... >> >> Thanks >> >> ThunderMusic >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl... >>> Thundermusic, >>> >>> What has that class to do? >>> >>> Cor >>> >>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >>> news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >>>> Hi, >>>> This question probably went back a couple of times, but I didn't find >>>> anything about it on google, so I ask here... >>>> >>>> What is the best way to use the DataSource/DataBind pattern in a class? >>>> I would like the user to be able to set a data source and I'd like my >>>> class to be able to use this datasource to build a DataTable I could >>>> use for further processing... >>>> >>>> Can it be done? if it can, how? >>>> >>>> Thanks >>>> >>>> ThunderMusic >>>> >>> >>> >> >> > > ok, but this DataBind(), what does it do under the hood? I mean, must it
convert the object datasource into whatever it is in reality? (IEnumerable, IList, et al.) thanks ThunderMusic "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: %23p42p29zGHA.4***@TK2MSFTNGP06.phx.gbl...Show quote > Thundermusic, > > In my idea are there only very few controls in WindowForms that can use > the datasource. > > That are the ListControls, the DataGrid and the DataGridView > (complex datacontrols) > > And that distinct them from the other controls which all can all however > only be binded using the DataBind. > > Cor > > > "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht > news:OyYwss9zGHA.4044@TK2MSFTNGP04.phx.gbl... >>I don't really understand what the purpose of the processing has to do >>with how to set a datasource and converting it to a DataTable, but I don't >>mind giving a little spoiler on what I'm doing (nobody won't know the >>overall of the project just by this tiny bit anyway) >> >> I must itterate in the rows and find some columns (colums names provided >> by the user in a property of the object) and display the values of these >> columns in graphs and charts... >> >> I know that most bindable controls can receive Arrays, List, SortedList, >> Dictionaries, DataTable, DataView, DataSet, et al. All thos controls >> don't behave the same at all when it comes to retrieve the data, so I >> don't want my objects to always try to find which object I'm working >> with... If there's an easy way of doing it, I wanna know... I just don't >> want to do if (datasource is DataSet) DoSomething; if (datasource is >> somethingelse) DoSomethingElse; and so on... If I can't do without it, >> I'll do it, but if I can do without, I'd prefer to do without... ;) and >> preferably I don't want to inherit from DataBoundControl because I'm not >> developing a control yet... the Data-Bound object is only a class that >> will be used in many of my controls... >> >> Thanks >> >> ThunderMusic >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl... >>> Thundermusic, >>> >>> What has that class to do? >>> >>> Cor >>> >>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >>> news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >>>> Hi, >>>> This question probably went back a couple of times, but I didn't find >>>> anything about it on google, so I ask here... >>>> >>>> What is the best way to use the DataSource/DataBind pattern in a class? >>>> I would like the user to be able to set a data source and I'd like my >>>> class to be able to use this datasource to build a DataTable I could >>>> use for further processing... >>>> >>>> Can it be done? if it can, how? >>>> >>>> Thanks >>>> >>>> ThunderMusic >>>> >>> >>> >> >> > > Thundermusic,
Is it this you are after? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcomponentmodelbindableattributeclasstopic.asp I hope this helps, Cor Show quote "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht news:eGGoKZC0GHA.4976@TK2MSFTNGP02.phx.gbl... > ok, but this DataBind(), what does it do under the hood? I mean, must it > convert the object datasource into whatever it is in reality? > (IEnumerable, IList, et al.) > > thanks > > ThunderMusic > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de > news: %23p42p29zGHA.4***@TK2MSFTNGP06.phx.gbl... >> Thundermusic, >> >> In my idea are there only very few controls in WindowForms that can use >> the datasource. >> >> That are the ListControls, the DataGrid and the DataGridView >> (complex datacontrols) >> >> And that distinct them from the other controls which all can all however >> only be binded using the DataBind. >> >> Cor >> >> >> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >> news:OyYwss9zGHA.4044@TK2MSFTNGP04.phx.gbl... >>>I don't really understand what the purpose of the processing has to do >>>with how to set a datasource and converting it to a DataTable, but I >>>don't mind giving a little spoiler on what I'm doing (nobody won't know >>>the overall of the project just by this tiny bit anyway) >>> >>> I must itterate in the rows and find some columns (colums names provided >>> by the user in a property of the object) and display the values of these >>> columns in graphs and charts... >>> >>> I know that most bindable controls can receive Arrays, List, SortedList, >>> Dictionaries, DataTable, DataView, DataSet, et al. All thos controls >>> don't behave the same at all when it comes to retrieve the data, so I >>> don't want my objects to always try to find which object I'm working >>> with... If there's an easy way of doing it, I wanna know... I just >>> don't want to do if (datasource is DataSet) DoSomething; if (datasource >>> is somethingelse) DoSomethingElse; and so on... If I can't do without >>> it, I'll do it, but if I can do without, I'd prefer to do without... ;) >>> and preferably I don't want to inherit from DataBoundControl because I'm >>> not developing a control yet... the Data-Bound object is only a class >>> that will be used in many of my controls... >>> >>> Thanks >>> >>> ThunderMusic >>> >>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >>> de news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl... >>>> Thundermusic, >>>> >>>> What has that class to do? >>>> >>>> Cor >>>> >>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >>>> news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >>>>> Hi, >>>>> This question probably went back a couple of times, but I didn't find >>>>> anything about it on google, so I ask here... >>>>> >>>>> What is the best way to use the DataSource/DataBind pattern in a >>>>> class? I would like the user to be able to set a data source and I'd >>>>> like my class to be able to use this datasource to build a DataTable I >>>>> could use for further processing... >>>>> >>>>> Can it be done? if it can, how? >>>>> >>>>> Thanks >>>>> >>>>> ThunderMusic >>>>> >>>> >>>> >>> >>> >> >> > > I dont really see how it can help me, but I'll try to find out...
thanks a lot for your help... ThunderMusic "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: e$WGD%23D0GHA.3***@TK2MSFTNGP03.phx.gbl...Show quote > Thundermusic, > > Is it this you are after? > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcomponentmodelbindableattributeclasstopic.asp > > I hope this helps, > > Cor > > "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht > news:eGGoKZC0GHA.4976@TK2MSFTNGP02.phx.gbl... >> ok, but this DataBind(), what does it do under the hood? I mean, must it >> convert the object datasource into whatever it is in reality? >> (IEnumerable, IList, et al.) >> >> thanks >> >> ThunderMusic >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: %23p42p29zGHA.4***@TK2MSFTNGP06.phx.gbl... >>> Thundermusic, >>> >>> In my idea are there only very few controls in WindowForms that can use >>> the datasource. >>> >>> That are the ListControls, the DataGrid and the DataGridView >>> (complex datacontrols) >>> >>> And that distinct them from the other controls which all can all however >>> only be binded using the DataBind. >>> >>> Cor >>> >>> >>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >>> news:OyYwss9zGHA.4044@TK2MSFTNGP04.phx.gbl... >>>>I don't really understand what the purpose of the processing has to do >>>>with how to set a datasource and converting it to a DataTable, but I >>>>don't mind giving a little spoiler on what I'm doing (nobody won't know >>>>the overall of the project just by this tiny bit anyway) >>>> >>>> I must itterate in the rows and find some columns (colums names >>>> provided by the user in a property of the object) and display the >>>> values of these columns in graphs and charts... >>>> >>>> I know that most bindable controls can receive Arrays, List, >>>> SortedList, Dictionaries, DataTable, DataView, DataSet, et al. All thos >>>> controls don't behave the same at all when it comes to retrieve the >>>> data, so I don't want my objects to always try to find which object I'm >>>> working with... If there's an easy way of doing it, I wanna know... I >>>> just don't want to do if (datasource is DataSet) DoSomething; if >>>> (datasource is somethingelse) DoSomethingElse; and so on... If I can't >>>> do without it, I'll do it, but if I can do without, I'd prefer to do >>>> without... ;) and preferably I don't want to inherit from >>>> DataBoundControl because I'm not developing a control yet... the >>>> Data-Bound object is only a class that will be used in many of my >>>> controls... >>>> >>>> Thanks >>>> >>>> ThunderMusic >>>> >>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >>>> de news: ORLGsk9zGHA.4***@TK2MSFTNGP06.phx.gbl... >>>>> Thundermusic, >>>>> >>>>> What has that class to do? >>>>> >>>>> Cor >>>>> >>>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht >>>>> news:eUDk398zGHA.3568@TK2MSFTNGP03.phx.gbl... >>>>>> Hi, >>>>>> This question probably went back a couple of times, but I didn't find >>>>>> anything about it on google, so I ask here... >>>>>> >>>>>> What is the best way to use the DataSource/DataBind pattern in a >>>>>> class? I would like the user to be able to set a data source and I'd >>>>>> like my class to be able to use this datasource to build a DataTable >>>>>> I could use for further processing... >>>>>> >>>>>> Can it be done? if it can, how? >>>>>> >>>>>> Thanks >>>>>> >>>>>> ThunderMusic >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > >
Other interesting topics
|
|||||||||||||||||||||||