Treeview problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bafidi

    Treeview problem

    i have a treeview1 control and i want to do this:

    i dont want to focus or select a node code is here

    if treeview1.selec tednode.text="" then
    msgbox ("Empty")
    else
    msgbox("Not Empty")
    end if

    but this results error it feels treeview1 = nothing and give error
    nullreferenceex ceptions
    object reference not set to an instance of an object
    how can i solve this is there a way
  • Cor Ligthert [MVP]

    #2
    Re: Treeview problem

    Bafidi,

    If you use the treeview, than it is very important to tell in what event you
    are somehing using. Almost all events fire at initializing so probably is
    that the reason of your error.

    Cor


    Comment

    • bafidi

      #3
      Re: Treeview problem

      i put a button1 on the form and click the button
      but i dont select a node in treeview1
      after click the button i want to see message box

      empty

      or not empty

      so if its empty i want to focus on treeview1 and select a node again

      if the

      "Cor Ligthert [MVP]" wrote:
      [color=blue]
      > Bafidi,
      >
      > If you use the treeview, than it is very important to tell in what event you
      > are somehing using. Almost all events fire at initializing so probably is
      > that the reason of your error.
      >
      > Cor
      >
      >
      >[/color]

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Treeview problem

        Bafidi,

        This will give an error if it is not selected (I been gone often in that
        hole).

        I thought that a test on
        if Not treeview1.selec tednode Is Nothing then
        'will go
        end if

        Cor


        Comment

        • bafidi

          #5
          Re: Treeview problem

          Thanks its ok now
          :)

          "Cor Ligthert [MVP]" wrote:
          [color=blue]
          > Bafidi,
          >
          > This will give an error if it is not selected (I been gone often in that
          > hole).
          >
          > I thought that a test on
          > if Not treeview1.selec tednode Is Nothing then
          > 'will go
          > end if
          >
          > Cor
          >
          >
          >[/color]

          Comment

          Working...