Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 17th, 2007, 09:02 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default please fix this function

hi,
i get error:hexvalue is used before it has been assigned a value
i used it in asp.net 1.1 but in 2.0 i get that error.please fix it
 Public Function hexValue(ByVal intHexLength As Integer) As String

            Dim intLoopCounter
            Dim strHexValue As String = ""
            'Dim hexValue As String
            Randomize()
            For intLoopCounter = 1 To intHexLength
                'Genreate a radom decimal value form 0 to 15
                intHexLength = CInt(Rnd() * 1000) Mod 16
                'Turn the number into a hex value
                Select Case intHexLength
                    Case 1
                        strHexValue = "1"
                    Case 2
                        strHexValue = "2"
                    Case 3
                        strHexValue = "3"
                    Case 4
                        strHexValue = "4"
                    Case 5
                        strHexValue = "5"
                    Case 6
                        strHexValue = "6"
                    Case 7
                        strHexValue = "7"
                    Case 8
                        strHexValue = "8"
                    Case 9
                        strHexValue = "9"
                    Case 10
                        strHexValue = "A"
                    Case 11
                        strHexValue = "B"
                    Case 12
                        strHexValue = "C"
                    Case 13
                        strHexValue = "D"
                    Case 14
                        strHexValue = "E"
                    Case 15
                        strHexValue = "F"
                    Case Else
                        strHexValue = "Z"
                End Select
                hexValue = hexValue & strHexValue

            Next

            Return strHexValue
        End Function

  #2 (permalink)  
Old September 17th, 2007, 01:40 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

hexvalue is not declared or you commented it on porpuose??

also hexvalue is the name of the function.. don't you have a call stack error???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
  #3 (permalink)  
Old September 18th, 2007, 04:46 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes i commented it out on purpose
here is the original function for asp.net 1.1 please convert it to asp.net 2.0
just test it in your application and you see what error i get

Function hexValue(ByVal intHexLength)

    Dim intLoopCounter
    Dim strHexValue

    'Randomise the system timer
    Randomize

    'Generate a hex value
    For intLoopCounter = 1 to intHexLength

        'Genreate a radom decimal value form 0 to 15
        intHexLength = CInt(Rnd * 1000) Mod 16

        'Turn the number into a hex value
        Select Case intHexLength
            Case 1
                strHexValue = "1"
            Case 2
                strHexValue = "2"
            Case 3
                strHexValue = "3"
            Case 4
                strHexValue = "4"
            Case 5
                strHexValue = "5"
            Case 6
                strHexValue = "6"
            Case 7
                strHexValue = "7"
            Case 8
                strHexValue = "8"
            Case 9
                strHexValue = "9"
            Case 10
                strHexValue = "A"
            Case 11
                strHexValue = "B"
            Case 12
                strHexValue = "C"
            Case 13
                strHexValue = "D"
            Case 14
                strHexValue = "E"
            Case 15
                strHexValue = "F"
            Case Else
                strHexValue = "Z"
        End Select

        'Place the hex value into the return string
        hexValue = hexValue & strHexValue
    Next
End Function

  #4 (permalink)  
Old September 18th, 2007, 07:12 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

did really this function work on 1.1??

this line: hexValue = hexValue & strHexValue it's very weird...

if you change it to hexValue = strHexValue should work (I think, because I don't know what's your idea...)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
  #5 (permalink)  
Old September 18th, 2007, 08:01 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes and now it works

 hexValue = hexValue & strHexValue
            Next
            Return hexValue

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fix Error sgafar ASP.NET 1.0 and 1.1 Basics 0 May 30th, 2007 10:22 AM
New Chapter 3 Fix .MAttButler BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 0 August 14th, 2006 09:08 PM
Need xref Fix ~Bean~ SQL Language 2 October 5th, 2005 02:45 PM
Help! How do I fix this? missusfinz Crystal Reports 1 April 1st, 2005 12:27 PM
how can i fix ERRO WITH MAIL() FUNCTION crappy PHP How-To 1 June 19th, 2003 03:03 PM



All times are GMT -4. The time now is 06:04 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.