Results 1 to 40 of 40

Thread: <serious> Pretty interesting question ..

  1. #1

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    <serious> Pretty interesting question ..

    Is it possible to Ctype a control to its actual type without knowing in advace at run time ..

    For Example

    dim objcontrol as Object

    ObjControl = new Label

    Ctype(ObjControl, Label).text ="blah" ' its fine ..

    but is it possible to do this ..

    Ctype(ObjControl, typeof(ObjControl)).text ... something like this since in the above example I had to know in advance that I was Ctyping a label while in the latter example I do not care what control it is just Ctype it to whatever type it has, that way following code would be possible to achieve.

    dim objcontrol as Object

    ObjControl = new Label

    Ctype(ObjControl, Typeof(ObjControl)).text ="blah" ' its fine ..

    ObjControl = new TextBox

    Ctype(ObjControl, Typeof(ObjControl)).text ="blah" ' its fine ..

    without actually knowing the type of the control ....

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

    Re: <serious> Pretty interesting question ..

    This situation would only ever arise if you had neglected other parts of your program so badly that you can no longer take advantage of OOP. You'd have to be an especially gifted bad programmer to mangle an app like that. I can only salute you from afar.

    Send us a postcard wont you?
    I don't live here any more.

  3. #3
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: <serious> Pretty interesting question ..

    Sorry.

    I tried, but I couldn't come up with a ctype method to do what you request.

    Could you use the following?

    VB Code:
    1. Public Sub TEST_THIS(ByRef mControl As Control, ByVal mText As String)
    2.         mControl.Text = mText
    3.     End Sub

    Or would you like something else.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: <serious> Pretty interesting question ..

    These questions should be posted in the VB forum ..
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    Maybe even VB.NET seeing as CType() doesn't exist in classic VB.

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: <serious> Pretty interesting question ..

    Sorry ..
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: <serious> Pretty interesting question ..

    Is this the passed "sender" object of an event procedure?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    What's the point? You're casting so that you can access specific members of that type, but if you don't know what the type is then how do you know what the members are? If you know that the object is a control then just cast it as a Control, from which all controls inherit their Text property anyway.

    Anyway, you can't use GetType in that situation because that returns an instance of the Type class and not a Type.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by jmcilhinney
    What's the point? You're casting so that you can access specific members of that type, but if you don't know what the type is then how do you know what the members are? If you know that the object is a control then just cast it as a Control, from which all controls inherit their Text property anyway.

    Anyway, you can't use GetType in that situation because that returns an instance of the Type class and not a Type.
    actually, no. Lets say you were looping through all your controls on a web page for assigning them text based on the language selected by user.

    Now textbox, label, button all have text property and option strict is on. One way to assign text would be something like this ..

    For each control as control in mycontrols

    if typeof control is textbox then
    ctype(control,textbox).text = "blah"
    end if


    if typeof control is button then
    ctype(control,button).text = "blah"
    end if


    if typeof control is label then
    ctype(control,label).text = "blah"
    end if

    Next

    But if you see in the end all we're doing is setting the text property so I should not have to check the type of the control in Ctype. All I want to say is something like this ..

    For each l_control as control in mycontrols

    ctype(l_control,"Whatever type it is at the moment for l_control").text = "blah"

    Next

    and it should work ...

  10. #10

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by wossname
    This situation would only ever arise if you had neglected other parts of your program so badly that you can no longer take advantage of OOP. You'd have to be an especially gifted bad programmer to mangle an app like that. I can only salute you from afar.

    Send us a postcard wont you?
    wossy, see my above post ..

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    Well you can't do that because while each of those properties may have the same name they are not the same property, because, in the case of Web controls, they are each members of different classes. Just because you think it should work because it is convenient for you has no bearing on reality. If they are all derived from a common base class and the property is inherited from that class, like System.Windows.Forms.Control.Text, then you can cast each object as a Control and access the common property that way. Otherwise you have to live by the rules of OOP and cast each object as the appropriate type. Your only other option is to turn Option Strict Off and use late-binding, but I think you know what the concensus is about that.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by jmcilhinney
    Well you can't do that because while each of those properties may have the same name they are not the same property, because, in the case of Web controls, they are each members of different classes. Just because you think it should work because it is convenient for you has no bearing on reality. If they are all derived from a common base class and the property is inherited from that class, like System.Windows.Forms.Control.Text, then you can cast each object as a Control and access the common property that way. Otherwise you have to live by the rules of OOP and cast each object as the appropriate type. Your only other option is to turn Option Strict Off and use late-binding, but I think you know what the concensus is about that.
    whatever you said here is something I am very well aware of .. what I asked originally if there was a way ....

  13. #13
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    And you've been told that there isn't a way because it defies logic, even if it seems convenient, and yet you still post that it SHOULD work. Well, the fact is that it doesn't work because it SHOULDN'T work because it breaks the rules. What you could do is use Reflection to determine whether the object had a property named Text and, if so, set it that way. That would take just as much code as the other way though, unless you had a large number of types to check for.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  14. #14
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: <serious> Pretty interesting question ..

    Rather than being coy how about telling us what you want to achieve? Save settings?
    Last edited by grilkip; Nov 18th, 2005 at 07:51 AM. Reason: no ' in want :D
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  15. #15
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Maine, USA
    Posts
    277

    Re: <serious> Pretty interesting question ..

    This n00b wants to know why you need to use Ctype if you already know a control's type?
    If you know that it is going to be a textbox why not just say textbox1.text = "blah"?

    Must be something I don't know here. ^^
    <deis> I turn on god mode when I program
    <deis> I just call it .NET


    If my post was helpful, please Rate it

  16. #16

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by Kal_Torak
    This n00b wants to know why you need to use Ctype if you already know a control's type?
    If you know that it is going to be a textbox why not just say textbox1.text = "blah"?

    Must be something I don't know here. ^^
    I ain't no noobe dude. What I am saying here makes sense if you think about it ... Although it appears that its not possible, however, I am simple saying CType should be intelligent enough to CAST the control to whatever type it is rather than us having to explicitly specify the type of the control.

  17. #17
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: <serious> Pretty interesting question ..

    OMG no it shouldn't.

    The control is already of the type that it is
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  18. #18
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    Laugh at me if this is stupid, but what's wrong with
    VB Code:
    1. For Each ctl As Control In myControls
    2.     ctl.Text = "Blah"
    3. Next
    ?

  19. #19

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by penagate
    Laugh at me if this is stupid, but what's wrong with
    VB Code:
    1. For Each ctl As Control In myControls
    2.     ctl.Text = "Blah"
    3. Next
    ?
    Won't work if Option Strict is ON. That is what is wrong with it ....

  20. #20

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by grilkip
    OMG no it shouldn't.

    The control is already of the type that it is
    Exactly, that is the point, if control is already of the type that I want it to be then why do I have to Ctype it to a specific type such as Label or Button ??

  21. #21
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    Because you don't know what type it is, therefore you cannot, with 100% certainity, know its interface.

    If you are using .NET 2, you might use the TryCast operator
    VB Code:
    1. For Each ctl As Control In myControls
    2.     Dim txtBox As TextBox = TryCast(ctl, TextBox)
    3.     If (txtBox IsNot Nothing) Then txtBox.Text = "blah"
    4. Next
    if I understood it right.

  22. #22

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by penagate
    Because you don't know what type it is, therefore you cannot, with 100% certainity, know its interface.

    If you are using .NET 2, you might use the TryCast operator
    VB Code:
    1. For Each ctl As Control In myControls
    2.     Dim txtBox As TextBox = TryCast(ctl, TextBox)
    3.     If (txtBox IsNot Nothing) Then txtBox.Text = "blah"
    4. Next
    if I understood it right.
    That's the thing, I do not want to know its type. I guess its not possible in .NET 1.1
    Last edited by spoiledkid; Nov 18th, 2005 at 12:41 PM.

  23. #23
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: <serious> Pretty interesting question ..

    Sounds like you are trying to create run-time polymorphism, which is not a feature in .NET 2003. It does have it's uses.
    My usual boring signature: Nothing

  24. #24
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    What you're talking about is late-binding, plain and simple. You're trying to tell the compiler that you won't know what type the object is until run time but you still want to set its Text property, but the compiler can't let you do that because it has to know at design time that the object has a Text property n order to compile the code. If you turn Option Strict Off then the compiler will allow late-binding because it doesn't check at compile time whether the type has the specified member. The thing is, you're saying that you should be able to use CType, but if you're going to go ahead and use the Text property no matter what type it is anyway, why would you even try to use CType? If the object has a Text property then it will work without CType and if it doesn't then it will throw an exception. CType is to cast to a specific type that you know at design time. Leaving it until run time to determine a type is called late-binding.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  25. #25
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    Yah, I don't want to start a debate over the merits of Option Strict, which no doubt has been done before (although personally I haven't a clue what other effects turning it off has), but IMO there is nothing wrong with late-binding per se; situations like this are what it's for...

    So what you're saying is basically this
    VB Code:
    1. For Each ctl As Control In myControls
    2.     Try
    3.         ctl.Text = "Blah"
    4.     Catch ex As Exception
    5.     End Try
    6. Next
    with Option Strict off, is the best solution?

    If Option Strict is such a big deal then I can't believe there isn't a more elegant method of achieving it with Option Strict on.

  26. #26
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: <serious> Pretty interesting question ..

    I think this is actually something that MS is working on (for a future .NET release... past 2005)... if I understand you right.. let me see if I can find the channel 9 video and you can watch it and see if its the same thing

  27. #27
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: <serious> Pretty interesting question ..

    here.

    its actually funny to watch too because these guys are VB superstars.. yet they have a little trouble coding in the video

    http://channel9.msdn.com/Showpost.aspx?postid=116702

  28. #28
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by spoiledkid
    I ain't no noobe dude. What I am saying here makes sense if you think about it ... Although it appears that its not possible, however, I am simple saying CType should be intelligent enough to CAST the control to whatever type it is rather than us having to explicitly specify the type of the control.
    Not sure.. but I think perhaps he was calling himself a noob???

  29. #29
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    I'm watching the video you linked to Matt. Nice to see their exceptions are as slow as mine

  30. #30
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: <serious> Pretty interesting question ..

    exceptions are generally only slow in debug mode on the first exception created.. they run fast when compiled in release mode and run from the EXE

  31. #31
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Maine, USA
    Posts
    277

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by kleinma
    Not sure.. but I think perhaps he was calling himself a noob???
    Right you are

    While KalsIQ <= lownumber
    kal = n00b
    next
    <deis> I turn on god mode when I program
    <deis> I just call it .NET


    If my post was helpful, please Rate it

  32. #32
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: <serious> Pretty interesting question ..

    Jimmy is right you are esentially late binding because since you don't know what type of control you are going to use until design time then the compiler can't know either so it can't check it for bugs until runtime.

    But you could use reflection to check the control for a text property and set it. It don't know if that counts as early or late binding - I assume it is late but it is a safe check of the property.
    VB Code:
    1. For Each ctrl As Control In MyControls
    2.  
    3.             If TypeOf (ctrl) Is Button Or TypeOf (ctrl) Is Label Or TypeOf (ctrl) Is TextBox Then
    4.                 Dim t As Type = ctrl.GetType
    5.                 Dim pi As Reflection.PropertyInfo = t.GetProperty("Text")
    6.                 If Not pi Is Nothing Then
    7.                     pi.SetValue(ctrl, "test", Nothing)
    8.                 End If
    9.             End If
    10.  
    11.         Next
    Last edited by Edneeis; Dec 5th, 2005 at 12:55 AM.

  33. #33
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by Edneeis
    Jimmy is right you are esentially late binding because since you don't know what type of control you are going to use until design time then the compiler can't know either so it can't check it for bugs until runtime.

    But you could use reflection to check the control for a text property and set it. It don't know if that counts as early or late binding - I assume it is late but it is a safe check of the property.
    VB Code:
    1. For Each ctrl As Control In MyControls
    2.  
    3.             If TypeOf (ctrl) Is Button Or TypeOf (ctrl) Is Label Or TypeOf (ctrl) Is TextBox Then
    4.                 Dim t As Type = ctrl.GetType
    5.                 Dim pi As Reflection.PropertyInfo = t.GetProperty("Text")
    6.                 If Not pi Is Nothing Then
    7.                     pi.SetValue(ctrl, "test", Nothing)
    8.                 End If
    9.             End If
    10.  
    11.         Next
    That's not late-binding because you know at design time the type of every object you are referencing. What you're doing in not late-binding just like using If statements to check the run-time type and execute the correct cast accordingly is not late-binding.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  34. #34
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    Couldn't you just do that without the If() block ? Seems a bit pointless to me if you are looking for the property anyway.

  35. #35
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by jmcilhinney
    That's not late-binding because you know at design time the type of every object you are referencing. What you're doing in not late-binding just like using If statements to check the run-time type and execute the correct cast accordingly is not late-binding.
    But isn't Reflection inheritly late bound or no? I mean there is no way for the compiler to check the metadata until runtime.

  36. #36
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    Using Reflection is similar to just using If statements to determine how to cast in that what you are saying is this is how to check whether a certain member is present and this is how to behave depending on what is found, whereas late-binding is saying just assume that a certain member is present and hope for the best, without being given any specific reason to believe that that member will actually be there.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  37. #37
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: <serious> Pretty interesting question ..

    I disagree Latebind (IMO) has more to do with determining the type at designtime or not using strongly typed objects. For instance the following code is still late binding even though it's logic is not incorrect:
    VB Code:
    1. Dim o As Object=New Form()
    2. o.Show()
    Since I declare the variable as Object then it will still 'LateBind' to a form at runtime but there is more overhead in determining it.

    Is this not correct?

    So using reflection and some weak polymorphing technics seem to be in the same vein as that example. They wait until runtime to infer the type, because Reflection never really casts the object. Well I don't know if Reflection is late binding or not but it works and works well.

  38. #38
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: <serious> Pretty interesting question ..

    I guess it depends on your definition of late-binding. According to the help/MSDN, having Option Strict turned On disallows late-binding, but you can quite happlily use Reflection with Option Strict turned On. As far as I'm concerned, late-binding means that the compiler doesn't know what type an object is when the code is compiled. Using Reflection has no bearing on this because using it doesn't mean that the compiler is in any doubt about any of the type of any of the objects being used. That's basically because of the existence of the Type class. You can create an instance of the Type class from any object and then use the members of the Type instance to determine various things about the original object. Because you are working with a Type instance and not the original object you are in no doubt about what members are available to you.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  39. #39
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <serious> Pretty interesting question ..

    You can use Reflection to achieve late binding. That doesn't mean it IS late binding.

  40. #40
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: <serious> Pretty interesting question ..

    Quote Originally Posted by penagate
    You can use Reflection to achieve late binding. That doesn't mean it IS late binding.
    This doesn't make any sense to me

    Ok I think I see what you are saying Jimmy.

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