FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Referring to CBox.selectedValue.toString() when not selected

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Wed Oct 15, 2008 3:04 pm    Post subject: Referring to CBox.selectedValue.toString() when not selected Reply with quote

Greetings!

I have a combobox (ProjBranch) that I am using on a search. It works perfectly fine when the ProjBranch.selectedValue.toString() has been chosen or clicked. However, if the combobox is not clicked on the search instance, an access violation is given.

the code is
Code:

    if (ProjBranch.selectedValue.toString() != " ")
    {
      q0 ~= " AND PSubClass LIKE '%" ~ ProjBranch.selectedValue.toString() ~ "%' ";
    }


I am trying to find out the combobox or listbox has been choosen, but I went to the site to see if I can find something, but could not. I tried,
Code:

    if (ProjBranch)
    {
      if (ProjBranch.selectedValue.toString() != " ")
      {
        q0 ~= " AND PSubClass LIKE '%" ~ ProjBranch.selectedValue.toString() ~ "%' ";
      }
    }


But as you can imagine, that also caused an Access Violation. Any ideas how to make this work?

thanks,

jose
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Fri Oct 17, 2008 4:41 pm    Post subject: Re: Referring to CBox.selectedValue.toString() Reply with quote

selectedValue is null if nothing is selected, so you're calling toString on a null object. Test for null first... if(ProjBranch.selectedValue) ...
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Sat Oct 18, 2008 1:09 pm    Post subject: Reply with quote

thanks. I knew I was missing something. I tried everything but that.

Thanks.

jic
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group