User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,100 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,489 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums

If Statements!....for a newbie :)

Join Date: Mar 2008
Location: Wales
Posts: 30
Reputation: BluePaper is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
BluePaper's Avatar
BluePaper BluePaper is offline Offline
Light Poster

Re: If Statements!....for a newbie :)

  #2  
Mar 22nd, 2008
Hey there ferrier, couldn't you just shorten that whole piece of code down to just 3 statements? I've done it here (without using Val, you can add it if you want and such):

  1. If TextBox1.Text = TextBox3.Text And TextBox2.Text = TextBox4.Text Or TextBox1.Text = TextBox4.Text And TextBox2.Text = TextBox3.Text Then
  2. Label6.Text = "Students share 2 subjects"
  3. ElseIf TextBox1.Text = TextBox3.Text And TextBox2.Text <> TextBox4.Text Or TextBox1.Text = TextBox4.Text And TextBox2.Text <> TextBox3.Text Or TextBox2.Text = TextBox4.Text And TextBox1.Text <> TextBox3.Text Or TextBox2.Text = TextBox3.Text And TextBox1.Text <> TextBox4.Text Then
  4. Label6.Text = "Students share 1 subject"
  5. Else
  6. Label6.Text = "Students share 0 subjects"
  7. End If

I think it works with every option if it doesn't then I'd have to sit down and work through it some more. Aye the middle elseif is just one huge statement lol.

Hope it works.

mhmm, looks like the VB.net highlighting syntax is incomplete
Stone In Focus - Caffeine Group - CoffeePHP - Open Notes - Onyx - Redpoint Network - Espresso
Reply With Quote  
All times are GMT -4. The time now is 1:57 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC