Click here to Skip to main content
15,908,254 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# and COM and return values. (newby question) Pin
leppie20-Jun-08 9:25
leppie20-Jun-08 9:25 
GeneralRe: C# and COM and return values. (newby question) Pin
leppie20-Jun-08 9:27
leppie20-Jun-08 9:27 
QuestionCannot seem to be able to write a byte[] to a file Pin
LCI20-Jun-08 7:56
LCI20-Jun-08 7:56 
AnswerRe: Cannot seem to be able to write a byte[] to a file Pin
Giorgi Dalakishvili20-Jun-08 8:06
mentorGiorgi Dalakishvili20-Jun-08 8:06 
AnswerRe: Cannot seem to be able to write a byte[] to a file Pin
leppie20-Jun-08 8:12
leppie20-Jun-08 8:12 
GeneralRe: Cannot seem to be able to write a byte[] to a file Pin
LCI20-Jun-08 8:22
LCI20-Jun-08 8:22 
GeneralRe: Cannot seem to be able to write a byte[] to a file Pin
leppie20-Jun-08 8:27
leppie20-Jun-08 8:27 
GeneralRe: Cannot seem to be able to write a byte[] to a file Pin
LCI20-Jun-08 8:32
LCI20-Jun-08 8:32 
QuestionHex String into number Pin
aman200620-Jun-08 7:26
aman200620-Jun-08 7:26 
AnswerRe: Hex String into number Pin
snorkie20-Jun-08 7:47
professionalsnorkie20-Jun-08 7:47 
GeneralRe: Hex String into number Pin
aman200620-Jun-08 7:56
aman200620-Jun-08 7:56 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:05
professionalsnorkie20-Jun-08 8:05 
GeneralRe: Hex String into number Pin
leppie20-Jun-08 8:17
leppie20-Jun-08 8:17 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:21
professionalsnorkie20-Jun-08 8:21 
GeneralRe: Hex String into number Pin
leppie20-Jun-08 8:29
leppie20-Jun-08 8:29 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:40
professionalsnorkie20-Jun-08 8:40 
GeneralRe: Hex String into number Pin
Brady Kelly20-Jun-08 8:57
Brady Kelly20-Jun-08 8:57 
JokeRe: Hex String into number Pin
Spacix One20-Jun-08 9:23
Spacix One20-Jun-08 9:23 
GeneralRe: Hex String into number Pin
aman200620-Jun-08 8:46
aman200620-Jun-08 8:46 
AnswerRe: Hex String into number Pin
leppie20-Jun-08 8:19
leppie20-Jun-08 8:19 
AnswerRe: Hex String into number Pin
Luc Pattyn20-Jun-08 9:13
sitebuilderLuc Pattyn20-Jun-08 9:13 
AnswerRe: Hex String into number Pin
carbon_golem20-Jun-08 9:16
carbon_golem20-Jun-08 9:16 
AnswerRe: Hex String into number [modified] Pin
Spacix One20-Jun-08 10:11
Spacix One20-Jun-08 10:11 
I'll 1/2 do your homework for ya Wink | ;)
Imports System
Imports System.Globalization
Imports System.Text

Module Module1
    Sub Main()
        Dim sb As New StringBuilder("1C0000")
        Dim str As String
        Dim value As Integer
        Dim bval As Byte
        Dim j As Double

        If (sb.Length Mod 2) = 1 Then
            sb.Append("0")
        End If
        str = sb.ToString()
        For i As Integer = 1 To str.Length Step 2
            j = Math.Pow(16, Convert.ToDouble(i - 1))
            bval = Byte.Parse(Mid(str, i, 2), NumberStyles.HexNumber, NumberFormatInfo.CurrentInfo)
            value += Convert.ToInt32(Convert.ToDouble(bval) * j)
        Next
        Console.WriteLine("The string {0} is equal to {1}", sb.ToString(), value)
    End Sub
End Module
Laugh | :laugh: (doh! fixed logic typo)


-Spacix
All your skynet questions[^] belong to solved

I dislike the black-and-white voting system on questions/answers. Dead | X|

modified on Friday, June 20, 2008 4:25 PM

GeneralRe: Hex String into number Pin
Guffa20-Jun-08 12:55
Guffa20-Jun-08 12:55 
GeneralRe: Hex String into number Pin
Spacix One23-Jun-08 3:37
Spacix One23-Jun-08 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.