View previous topic :: View next topic |
Author |
Message |
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Wed Oct 15, 2008 3:04 pm Post subject: Referring to CBox.selectedValue.toString() when not selected |
|
|
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 |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Fri Oct 17, 2008 4:41 pm Post subject: Re: Referring to CBox.selectedValue.toString() |
|
|
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 |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Sat Oct 18, 2008 1:09 pm Post subject: |
|
|
thanks. I knew I was missing something. I tried everything but that.
Thanks.
jic |
|
Back to top |
|
|
|