Click here to Skip to main content
15,924,452 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Bitwise Enumeration? Pin
Briga15-Oct-05 3:47
Briga15-Oct-05 3:47 
GeneralRe: Bitwise Enumeration? Pin
Briga15-Oct-05 3:48
Briga15-Oct-05 3:48 
QuestionControlling sndrec32.exe Pin
jmachacek13-Oct-05 4:51
jmachacek13-Oct-05 4:51 
Questionprogrammatically changing the default windows cursor Pin
medicenpringles13-Oct-05 3:35
medicenpringles13-Oct-05 3:35 
AnswerRe: programmatically changing the default windows cursor Pin
jo0ls15-Oct-05 17:07
jo0ls15-Oct-05 17:07 
QuestionStarting Point. Pin
UniBond13-Oct-05 2:02
UniBond13-Oct-05 2:02 
AnswerRe: Starting Point. Pin
Tom John13-Oct-05 3:32
Tom John13-Oct-05 3:32 
QuestionComma Separated Numbers Pin
Greeky13-Oct-05 1:38
Greeky13-Oct-05 1:38 
How could i re-write this code more effective

i aim to do this
if number is 234 , result will be 234.00
if number is 1234 , result will be 1,234.00
if number is 1234.4 , result will be 1,234.40
if number is 1234.45 , result will be 1,234.45
if number is 1234.4522 , result will be 1,234.4522
if number is 1234.452284 , result will be 1,234.4523


    Shared bNumberIsNegative As Boolean = False<br />
    Public Shared Function SetComma(ByVal dblNumber As Double) As String<br />
        Try<br />
            If dblNumber < 0 Then bNumberIsNegative = True Else bNumberIsNegative = False<br />
            dblNumber = Math.Abs(dblNumber)<br />
            dblNumber = Math.Round(dblNumber, 4)<br />
            Dim dblNumberWithOutComma As String = dblNumber.ToString<br />
            Dim strNumberWithComma As String = ""<br />
            Dim shrDotIndex As Short = dblNumberWithOutComma.IndexOf(".")<br />
            Dim i As Integer<br />
            Dim k As Integer<br />
            If shrDotIndex = -1 Then shrDotIndex = dblNumberWithOutComma.Length<br />
            For i = shrDotIndex - 1 To 0 Step -1<br />
                k = shrDotIndex - 1 - i<br />
                If (k Mod 3) = 0 And Not k = 0 Then strNumberWithComma = "," & strNumberWithComma<br />
                strNumberWithComma = dblNumberWithOutComma.Chars(i) & strNumberWithComma<br />
            Next<br />
            strNumberWithComma &= dblNumberWithOutComma.Substring(shrDotIndex, dblNumberWithOutComma.Length - shrDotIndex)<br />
            Select Case dblNumberWithOutComma.Length - shrDotIndex<br />
                Case 0 : strNumberWithComma &= ".00"<br />
                Case 2 : strNumberWithComma &= "0"<br />
            End Select<br />
            If bNumberIsNegative Then strNumberWithComma = "-" & strNumberWithComma<br />
            Return strNumberWithComma<br />
        Catch ex As Exception<br />
<br />
        End Try<br />
    End Function


-- modified at 7:45 Thursday 13th October, 2005
AnswerRe: Comma Separated Numbers Pin
Tom John13-Oct-05 3:24
Tom John13-Oct-05 3:24 
QuestionCan subroutine in VB DLL accept array variable argument??? Pin
Anonymous13-Oct-05 0:58
Anonymous13-Oct-05 0:58 
Questiontrap-inputbox Pin
himanshu_softin12-Oct-05 23:44
himanshu_softin12-Oct-05 23:44 
Questionhow to report the bugs together with program status such as procedure name, call stack, code line and variable contents Pin
sanjaysanju12-Oct-05 23:18
sanjaysanju12-Oct-05 23:18 
AnswerRe: how to report the bugs together with program status such as procedure name, call stack, code line and variable contents Pin
Briga13-Oct-05 5:04
Briga13-Oct-05 5:04 
AnswerRe: how to report the bugs together with program status such as procedure name, call stack, code line and variable contents Pin
Qhalis13-Oct-05 8:06
Qhalis13-Oct-05 8:06 
QuestionMake size on Win UserControl dynamic Pin
Spaz8012-Oct-05 21:30
Spaz8012-Oct-05 21:30 
AnswerRe: Make size on Win UserControl dynamic Pin
Spaz8012-Oct-05 22:07
Spaz8012-Oct-05 22:07 
Questionhow can i add value n combobox Pin
shashank veerkar12-Oct-05 20:13
shashank veerkar12-Oct-05 20:13 
AnswerRe: how can i add value n combobox Pin
_mubashir12-Oct-05 21:30
_mubashir12-Oct-05 21:30 
AnswerRe: how can i add value n combobox Pin
toxcct12-Oct-05 23:23
toxcct12-Oct-05 23:23 
Questionadd tab page to crystal report viewer Pin
kikde12-Oct-05 19:38
kikde12-Oct-05 19:38 
Questioni need a help about &quot;network application libraries&quot; Pin
abuassad_a12-Oct-05 17:25
abuassad_a12-Oct-05 17:25 
QuestionHOw to read text file that will return the value to excel Pin
isaii12-Oct-05 16:20
isaii12-Oct-05 16:20 
AnswerRe: HOw to read text file that will return the value to excel Pin
Tom John13-Oct-05 3:28
Tom John13-Oct-05 3:28 
GeneralRe: HOw to read text file that will return the value to excel Pin
isaii13-Oct-05 17:03
isaii13-Oct-05 17:03 
GeneralRe: HOw to read text file that will return the value to excel Pin
isaii16-Oct-05 16:21
isaii16-Oct-05 16:21 

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.