Using VB.Net 2008 to convert from ASP.NET 2005

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 27
Reputation: Sheryl99 is an unknown quantity at this point 
Solved Threads: 0
Sheryl99 Sheryl99 is offline Offline
Light Poster

Using VB.Net 2008 to convert from ASP.NET 2005

 
0
  #1
Dec 4th, 2008
I am studying VB.NET in a VB 2005 book, but using VB 2008. What is wrong with this code? I am using ASP.NET to write a web page. For each reference to:

ResultFahrenheit.Text
ResultCelsius.Text
ResultKelvin.Text

I get errors that say:
Name 'ResultFahrenheit' is not declared.
Name 'ResultCelsius' is not declared.
Name 'ResultKelvin' is not declared.

Each of these fields is a cell in a table. I tried naming the table to 'table1', then adding:

table1.ResultFahrenheit...

This took the error away from 'ResultFahrenheit', but put it on 'table1'. So, apparently the 'ResultFahrenheit' needs some type of prefix.

I'd appreciate any suggestions.
Thanks

  1. ' ----- The conversion occurs here.
  2. Dim origValue As Double
  3.  
  4. If (IsNumeric(SourceValue.Text) = True) Then
  5. ' ----- The user supplied a number. Convert it.
  6. origValue = CDbl(SourceValue.Text)
  7. If (SourceType.SelectedValue = "F") Then
  8. ' ----- From Fahrenheit.
  9. ResultFahrenheit.Text = CStr(origValue)
  10. ResultCelsius.Text = CStr((origValue - 32) / 1.8)
  11. ResultKelvin.Text = CStr(((origValue - 32) / 1.8) + _
  12. 273.15)
  13. ElseIf (SourceType.SelectedValue = "C") Then
  14. ' ----- From Celsius.
  15. ResultFahrenheit.Text = CStr((origValue * 1.8) + 32)
  16. ResultCelsius.Text = CStr(origValue)
  17. ResultKelvin.Text = CStr(origValue + 273.15)
  18. Else
  19. ' ----- From kelvin.
  20. ResultFahrenheit.Text = CStr(((origValue - 273.15) * _
  21. 1.8) + 32)
  22. ResultCelsius.Text = CStr(origValue - 273.15)
  23. ResultKelvin.Text = CStr(origValue)
  24. End If
  25. Else
  26. ' ----- Unknown source value.
  27. ResultFahrenheit.Text = "???"
  28. ResultCelsius.Text = "???"
  29. ResultKelvin.Text = "???"
  30. End If
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,152
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Using VB.Net 2008 to convert from ASP.NET 2005

 
0
  #2
Dec 4th, 2008
the are labels or some other GUI component

do you have labels with these names?

and 2005 and 2008 use 99% of the same code, its not a problem there
Last edited by jbennet; Dec 4th, 2008 at 1:06 pm.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 63
Reputation: 4advanced is an unknown quantity at this point 
Solved Threads: 10
4advanced 4advanced is offline Offline
Junior Poster in Training

Re: Using VB.Net 2008 to convert from ASP.NET 2005

 
0
  #3
Dec 4th, 2008
Try to find the Table, TableRow, TableCells OR Fields with yourPage.FindControl("")
If the control will be found the value can be added to it. As jbennet says, the code didn't change thát much.... so it's strange it worked in 2005 and not in 2008.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC