Results 1 to 4 of 4

Thread: Is this OK?

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Is this OK?

    I'd like your opinions on this line of code...

    VB Code:
    1. 'type Boundary is a custom class
    2. 'frmViewEditBoundary is a form that returns a Boundary instance
    3.  
    4. Dim temp As Boundary = (New frmViewEditBoundary).ShowDialog()

    Is this acceptable coding practice? Or is there a cleaner way to get the same effect.

    The code works fine but I'm not sure if its in line with oop practice. I liked it because it saves having to dim the form on a separate line of code. The form is not needed afterwards.

    What are your thoughts please?
    Last edited by wossname; Apr 23rd, 2004 at 05:22 AM.
    I don't live here any more.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    As long as you don't need to refer to the same instance more than once, I see no problem with it. Doesn't get much cleaner.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Good. I've never seen this technique used elsewhere though, which makes me wonder if there is a reason!
    I don't live here any more.

  4. #4
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    ive always liked the idea you can declare the variable and assign it in the same line.
    some people think it makes VB.NET feel more like C++ by doing this, but i just see it as a more efficient way of writing code.
    i dont see anything wrong with it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width