Results 1 to 9 of 9
  1. #1

    Default Mga experts, how do i this? (VB.NET)


    Lets say I wanna reference an object like Button1 to Button10 .
    I make a loop form 1 to 10 and use a string as name so string = "Button" & X

    So unsaon mga bro na if I say string.PerfromClick, katung button with same name will be clicked?

  2. #2

    Default Re: Mga experts, how do i this? (VB.NET)

    use reflections

    you cant do string.Onclick stuff.

    but you can do something like

    Type.InvokeMember(.....)

    where type is being initialize from a string type name.

  3. #3
    uh, la ko kasabot sa code. can u plz help me. the name of the object is "btnAdd" which is the value of Name . So unsaon nako nigamit invoke na maclick nako ang btnAdd by using the Name string?

  4. #4
    Make your buttons into arrays.
    You could address it directly with button[x].PerformClick.

    Or you could make series of "if" statements.

    if buttonstring="button1" then
    button1.PerformClick
    endif
    ...

  5. #5
    you might want to read this

    How to: Hook Up a Delegate Using Reflection

    or you can do something like

    dim hash as new hastable

    hash.add("key1",object1)

    hash.add("key2",object2)

    ...
    ...

    public sub dostuff(s as string, hash as hashtable)
    dim c as Button = hash(s)
    c.PerformClick()
    end sub
    Last edited by silent-kill; 05-30-2008 at 09:48 AM.

  6. #6
    I'll go for an array. Array na lang imong buttons. walay daghang kuti. all you need is the index. that all.

  7. #7

    Default hehehe:! may sender object naman!!!

    bro s vb.net meron tinatawag n sender para hindi kna mag create ng code to reflect it to the other button. just used the handle..:o

  8. #8
    help also....
    what is the code for connecting to sql server??
    example is that if you made a add button of a form registration for xmple..then it will add to the database...
    how is it??

  9. #9
    just google it

  10.    Advertisement

Similar Threads

 
  1. Replies: 53
    Last Post: 10-04-2014, 01:17 PM
  2. Replies: 25
    Last Post: 07-02-2009, 10:03 PM
  3. SE W610i: How do you rate this phone?
    By zebran in forum Gizmos & Gadgets (Old)
    Replies: 5
    Last Post: 07-20-2007, 08:43 PM
  4. How do you find this phone???
    By laser in forum Gizmos & Gadgets (Old)
    Replies: 25
    Last Post: 11-09-2006, 07:06 PM
  5. how do i remove this?
    By c_cebrecus in forum Software & Games (Old)
    Replies: 18
    Last Post: 07-13-2006, 10:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top