Click here to Skip to main content
15,889,865 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: TERMINAL SERVICE CONTROL IN VB.6 Pin
Smithers-Jones11-Feb-09 1:13
Smithers-Jones11-Feb-09 1:13 
QuestionSynchronizaiton (Multithreading) Pin
Muhammad Fahim Baloch10-Feb-09 20:26
Muhammad Fahim Baloch10-Feb-09 20:26 
AnswerRe: Synchronizaiton (Multithreading) Pin
Dave Kreskowiak11-Feb-09 1:33
mveDave Kreskowiak11-Feb-09 1:33 
AnswerRe: Synchronizaiton (Multithreading) Pin
Ashfield11-Feb-09 1:33
Ashfield11-Feb-09 1:33 
QuestionSmall Issue, Needs Urgent help Pin
shawndeprey10-Feb-09 10:16
shawndeprey10-Feb-09 10:16 
AnswerRe: Small Issue, Needs Urgent help Pin
Christian Graus10-Feb-09 12:49
protectorChristian Graus10-Feb-09 12:49 
GeneralRe: Small Issue, Needs Urgent help Pin
shawndeprey10-Feb-09 14:52
shawndeprey10-Feb-09 14:52 
AnswerRe: Small Issue, Needs Urgent help Pin
Fernando Soto10-Feb-09 17:37
Fernando Soto10-Feb-09 17:37 
Hi shawndeprey;

The code below will correctly format the strings. The other issue you will have is that the font assign to controls by default are not monospace font meaning that each character will have a different width and therefore will never line up. What you need to do is go to the property page for the control and change the font of that control to a monospace font. One such font is Consolas. Once you have made this and the code change it will line up.

' You need two format strings one that has all text
' One that has currency values at the end.
Dim headerStr As String = "{0,-10}{1,30}"
' The C in the format string formats the number in 
' currency format, $999.99, no need to add $ to string
Dim frmStr As String = "{0,-10}{1,30:C}"
Dim cust As String
Dim a, b, sum1, sum2, sum3, sum4 As Double
a = CDbl(txtHour.Text)
b = CDbl(txtPart.Text)
sum1 = a * 35
sum2 = b * 0.05
sum3 = b + sum2
sum4 = sum1 + sum3
cust = txtCust.Text

lstOutput.Items.Clear()
lstOutput.Items.Add(String.Format(headerStr, "Customer", cust))
lstOutput.Items.Add(String.Format(frmStr, "Labor Cost", sum1))
lstOutput.Items.Add(String.Format(frmStr, "Parts Cost", sum3))
lstOutput.Items.Add(String.Format(frmStr, "Total Cost", sum4))


Fernando
GeneralRe: Small Issue, Needs Urgent help Pin
shawndeprey11-Feb-09 13:38
shawndeprey11-Feb-09 13:38 
GeneralRe: Small Issue, Needs Urgent help Pin
Fernando Soto11-Feb-09 16:22
Fernando Soto11-Feb-09 16:22 
Question[Message Deleted] Pin
JUNEYT10-Feb-09 6:15
JUNEYT10-Feb-09 6:15 
GeneralRe: Why do I get "System.ArgumentOutOfRangeException" for recently added columns to listview? Pin
Luc Pattyn10-Feb-09 6:27
sitebuilderLuc Pattyn10-Feb-09 6:27 
AnswerRe: Why do I get "System.ArgumentOutOfRangeException" for recently added columns to listview? Pin
Dave Kreskowiak10-Feb-09 6:36
mveDave Kreskowiak10-Feb-09 6:36 
RantRe: [Message Deleted] Pin
Smithers-Jones10-Feb-09 7:21
Smithers-Jones10-Feb-09 7:21 
Questionimages/photos/pictures Pin
ngugi10-Feb-09 5:42
ngugi10-Feb-09 5:42 
AnswerRe: images/photos/pictures Pin
Henry Minute10-Feb-09 6:19
Henry Minute10-Feb-09 6:19 
AnswerRe: images/photos/pictures Pin
Dave Kreskowiak10-Feb-09 6:34
mveDave Kreskowiak10-Feb-09 6:34 
QuestionAdding a control from within a class Pin
Paul Hasler10-Feb-09 4:16
Paul Hasler10-Feb-09 4:16 
AnswerRe: Adding a control from within a class Pin
JoeSharp10-Feb-09 4:30
JoeSharp10-Feb-09 4:30 
GeneralRe: Adding a control from within a class Pin
Jon_Boy10-Feb-09 5:31
Jon_Boy10-Feb-09 5:31 
AnswerRe: Adding a control from within a class Pin
Dave Kreskowiak10-Feb-09 6:33
mveDave Kreskowiak10-Feb-09 6:33 
AnswerRe: Adding a control from within a class Pin
Paul Hasler10-Feb-09 11:47
Paul Hasler10-Feb-09 11:47 
QuestionTwo questions regarding custom user controls and the toolbox. Pin
Jon_Boy10-Feb-09 3:39
Jon_Boy10-Feb-09 3:39 
AnswerRe: Two questions regarding custom user controls and the toolbox. Pin
Dave Kreskowiak10-Feb-09 4:05
mveDave Kreskowiak10-Feb-09 4:05 
GeneralRe: Two questions regarding custom user controls and the toolbox. Pin
Jon_Boy10-Feb-09 4:17
Jon_Boy10-Feb-09 4:17 

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.