By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

If Statement logic

maylortaylor
P: 72
So I have two If statements and an overloaded function that needs to be used. I can't seem to figure out the logic for how to get this to work as i want it.

Expand|Select|Wrap|Line Numbers
  1.  If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
  2.                     CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  3.                 Else
  4.  
  5.  
  6.                     If CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper) Then
  7. ''LOTS OF CODE THAT I DONT WANT TO POST''
  8.  
Ideally, I want the first IF to check if 'ZipCode' is Null...if it is > it uses the CanBeAssigned(county,state,status) function and then does the ''LOTS OF CODE THAT I DONT WANT TO POST'' ...

...however, if 'ZipCode' is NOT NULL then it uses the CanBeAssigned(zipcode,status) and then proceeds to do the''LOTS OF CODE THAT I DONT WANT TO POST'' .
Apr 16 '13 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,382
I can't seem to figure out the logic for how to get this to work as i want it.
We can't figure it out either because you haven't explained how you want it to work.
Apr 16 '13 #2

Expert 5K+
P: 8,434
Looks to me as though you need to put your End If right after line 6, and remove the IF test on line 6. Something like...
Expand|Select|Wrap|Line Numbers
  1. If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
  2.   CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  3. Else
  4.   CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
  5. End If
  6. ''LOTS OF CODE THAT I DONT WANT TO POST''
  7.  
Sorry if I've misunderstood the question.
Jul 20 '13 #3

Expert 5K+
P: 8,434
Huh?

Apart from being unindented and not flagged as code, that's exactly what I posted.

Edit: Looks like the offending post has been removed, leaving this comment looking silly. Wish I could delete it.
Jul 23 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.