Declaring variables in the middle of your code.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jay B. Harlow [MVP - Outlook]

    #16
    Re: Declaring variables in the middle of your code.

    CR[color=blue]
    > Didn't they have something called a DataControl in VB6? I just assumed
    > that was the same type of thing.[/color]
    Same type of thing, IMHO significantly better implementation! (I've seen
    others say the same thing).
    [color=blue]
    > I think it's fairly common for me to modify the data somewhat before I
    > display in a listbox. The hyphenated example was a bit extreme, but
    > the idea is that I don't always display data straight out of the
    > database. I'll have to give the DataSource a try, however. I didn't
    > know you could use it with straight code, I can't stand using wizards.[/color]
    Remember you can put "computed" columns in a DataTable, so you can message
    the data to a certain degree without an "exterior" loop.
    [color=blue]
    > My goal is to be able to use the same method, even if it's
    > inefficient. For example when filling a listbox I don't want to fill
    > it using the DataSource one time and then ListBox.Items.A dd another[/color]
    Understood, on a project by project basis I do that.

    If you don't have it and I have not mentioned it, you may want to consider
    getting David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS
    Press it is a very good tutorial (on a number of topics we touched on in
    this thread) as well as a good desk reference once your using ADO.NET.

    Hope this helps
    Jay

    "CR" <cr113@hotmail. com> wrote in message
    news:1ab0ed1b.0 401150735.6cc5a b99@posting.goo gle.com...[color=blue]
    > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message[/color]
    news:<u$rFIzx2D HA.1392@TK2MSFT NGP11.phx.gbl>. ..[color=blue][color=green]
    > > CR,[color=darkred]
    > > > I hate to argue with someone who is helping me but I can't help it :).[/color]
    > > Is this an argument, a debate or a discussion. I figure its a[/color][/color]
    discussion![color=blue][color=green]
    > >
    > > Also I have images of the "exact" programs that you are referring to!!
    > >
    > > I've actually seen both! Poorly written code that uses a lot of[/color][/color]
    subroutines[color=blue][color=green]
    > > and poorly written code that does not use any subroutines. Just goes to[/color][/color]
    show[color=blue][color=green]
    > > Poor code is Poor code, despite the paradigm one chooses to use! :-) Of
    > > course what you or I consider poor code may be the rest of the teams[/color][/color]
    gold[color=blue][color=green]
    > > code...[/color]
    >
    > Now that I think about it I use Fill_ListBox subroutines constantly
    > (oops!). Usually when there's a situation when I want to fill the
    > ListBox during the Form_Load event and later when the user clicks on a
    > button. Forget about what I said about never using it. I think the
    > most important reason to make a sub is for it to be reusable. If
    > you're just doing it to make your routine shorter, that's a bad
    > reason.
    >[color=green][color=darkred]
    > > > I have a question about the DataSource. I've never used it in the
    > > > earlier versions because I didn't think it was flexible.[/color]
    > > What do you mean "earlier versions"? DataSource is new with VB.NET 2002,[/color][/color]
    it[color=blue][color=green]
    > > is a extremely simple & flexible way of populating "list" controls.[/color]
    >
    > Didn't they have something called a DataControl in VB6? I just assumed
    > that was the same type of thing.
    >[color=green][color=darkred]
    > > > What if I
    > > > wanted to hyphenate every other entry in a listbox (for whatever
    > > > reason)?[/color]
    > > Realistically often you do you need that? It seems more the exception[/color][/color]
    then[color=blue][color=green]
    > > the norm...[/color]
    >
    > I think it's fairly common for me to modify the data somewhat before I
    > display in a listbox. The hyphenated example was a bit extreme, but
    > the idea is that I don't always display data straight out of the
    > database. I'll have to give the DataSource a try, however. I didn't
    > know you could use it with straight code, I can't stand using wizards.
    >[color=green]
    > > The point Cor & I are attempting to make about the DataSource, is we[/color][/color]
    would[color=blue][color=green]
    > > NOT populate a DataTable (DataSet) simply to iterate over it to populate
    > > Items collection, if I populated the DataSet I would use the DataSource,[/color][/color]
    if[color=blue][color=green]
    > > I needed to populate just the ITems collection (for hyphenation for[/color][/color]
    example)[color=blue][color=green]
    > > I would use a DataReader... (sample of DataReader given in early post).[/color][/color]
    As[color=blue][color=green]
    > > the DataSource property can be used in the designer and produces very
    > > compact code.[/color]
    >
    > My goal is to be able to use the same method, even if it's
    > inefficient. For example when filling a listbox I don't want to fill
    > it using the DataSource one time and then ListBox.Items.A dd another
    > time. Same thing with the Datareader vs the DataSet. I'd prefer to use
    > the DataSet all the time, even if it would be more efficient to use
    > the DataReader. My programs are fast enough that I don't worry about
    > speed, I just want them to be easy to maintain.
    >
    > Thanks!
    >
    > Chuck.[/color]


    Comment

    Working...