Formatting Output With Zones
Oct 6, 2009Ex) Dim fmtstr as string="{0,15}{1,10}{2,8}" if I understand correctly the leftmost number is the zone number and the number to the right is the character width?
View 5 RepliesEx) Dim fmtstr as string="{0,15}{1,10}{2,8}" if I understand correctly the leftmost number is the zone number and the number to the right is the character width?
View 5 RepliesIs there a rule of thumb used to set the character width of a zone?
For example:
Dim fmtstr As String = "{0,-10}{1,12}{2,14}{3,12}"
lstcolleges.Items.Clear()
lstcolleges.Items.Add(String.Format(fmtstr, "College", "enrollment", "endowment", "public ss"))
This will align the text nicely into a list box. How do I determine how to set the character width?
I tried and tried to understand it. but i need a simple explaination....
View 1 RepliesI am trying to convert CST to 3 different times zones 9.5 ---Afgan and 5----UTC. I Have got this to work 3 ways now But i need it in "HHmm" format with no : currently going from value to text to string is the only way i can get the look i want. I need to either Add +5 to the write string (assuming that will still stay in 24 format if that's done) or i need a solid way to convert to HHmm without the coloHeres what i got,
oonwH = Convert.ToDateTime(oonwHr.Value)
oonwM = Convert.ToDateTime(oonwmin.Value)
I KNOW these lines are useless just haven't taken them out yet
[code]....
How is it posible to align each "Column", so that, no matter the size of each value, the columns line up perfectly under each other. I'm using a listbox for the output, I thought I had an understanding of this but apparently I don't. I am using a fixed width font and the screenshot shows my results. I have done this before but not in awhile.how to set up the zones. I know the minus sign in front will left justify the column results but I'm having trouble with the other columns.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fmtTicketInfo As String = "{0,3} {1,-20:} {2,20:c2} {3,20:c2}"
lstTicketBox.Items.Clear()[code]....
I'm having trouble lining up data from a file with their respectable columns in a list box. I am using print zones to space out data evenly, but when i run the program the output is still messy. So I need lining up columns properly together. As of now, the first 2 list box items line up with each other perfectly, the data i am looping through to add to list box is not lining up correctly. I have changed my zones several times, but still no luck.
A chunk of my code (some) :
Dim fmtstr1 As String = "{0,-5} {1,20} {2,7} {3,7} {4,7} {5,7} {6,7} {7,8} {8,12}"
Dim fmtstr2 As String = "{0,-5} {1,20} {2,7} {3,7} {4,7} {5,7} {6,7} {7,8} {8,12}"
Dim fmtstr3 As String = "{0,-5} {1,10} {2,7} {3,7} {4,7} {5,7} {6,7} {7,8} {8,12}"
[CODE]...
my listbox contents output as 1 whole row like:Total Normal = 3 Total High = 5 Total Low = 6When i want the output to be formatted like:
Total Normal = 3
Total High = 5
Total Low = 6
[code].....
I am currently trying to save a piece of data extracted from a piece of hardware in my office and save it as a text file. The problem now is, the text file saves the data like this:
[Code].....
I have been searching for a way to format output using writeline/write (streamwriter)using RTF tags and wondering if there is a syntax for this, if it exists. I have not been able to find a resource which clearly explains how to "pretty" up output sent to a file.
The reason why I am asking is because I want to "print" results from my program into a file that, at the very least, would be centered, tabbed and even bolded where possible without requiring the user to go and futz with it. I think I saw that Crystal Reports won't work with VB 2010 Express and, quite frankly, just want to create a file with output.
[Code]...
So I'm attempting to get three variable to print in a string, but I can't figure out how to make the Concat or Join commands to work properly. I've tried assigning the strings to a defined string variable and then "concatting" that and trying to do it in one big line. I keep getting an error either way. Here's what I have so far:
Str1 = PaymentNumInteger
Str2 = NewBalanceDecimal.ToString("C")
Str3 = MonthlyIntPayDecimal.ToString("C")
[code].....
I am building an XML string programatically using the XmlWriter ...
sb = New StringBuilder()
writer = XmlWriter.Create(sb)
writer.WriteStartDocument()
[Code]......
I want to be able to output the XML to a TextBox control on a ASP.NET webform. When I do output the XML I don't get any line breaks or indentation in the XML. The XmlWriter does not seem to have any properties to set formatting. Is there anyway to retain formatting and indentation?
I'm using the following function to generate a list of users connected to a selected database. How would I change this to a single line for multiple identical results?For example: "sa (3) - MYCOMPUTER" rather than listing "sa - MYCOMPUTER" three times?
Function ConnectedUsers(ByVal SelectedDatabase As String, ByVal SelectedInstance As String)
Dim myCommand As SqlCommand
Dim dr As SqlDataReader
[code]....
I am currently trying to save a piece of data extracted from a piece of hardware in my office and save it as a text file. The problem now is, the text file saves the data like this:
[code].....
There are 3 buttons and 5 textboxes in my program. ignore the "plot" button as that is a machine specific code, as well as any weird lines like
Dim mgr As Ivi.Visa.Interop.ResourceManager
as these were provided by my machine vendor. I only need help with the data formatting.I am trying to program the "Agilent 8757D Scalar Network Analyzer.
I would like to have my output in columns, and the numbers in two digit after the decimal.
I am writing a data validation app where the app asks the user for input like give me a number of double type: and hopefully the user will comply.
But the app will test some validation rules and then:
1) if the user simply pressed enter the app will tell the user all sorts of reasons why the input was rejected. And that part should look like a table with columns for the entry, if it passed true, otherwise false and then the reason line empty input. Or this number is a string.
How to format numbers in VB.Net. All I want is properly inserted commas in my final output. Such as:
lvwItem.SubItems.AddRange(New String() {ConvertToMegabytes(CULng(LogicalDrive.TotalSize)).ToString})
I have three functions which I use to convert various numbers to MB GB and TB. I would like to have the final output number be properly formatted with commas as necessary.
Private Function ConvertToMegabytes(lngbytes As ULong) As String
Return (CDec(lngbytes) / 1024D / 1024D).ToString("F1") & " MB"
End Function
Private Function ConvertToGigabytes(lngbytes As ULong) As String
Return (CDec(lngbytes) / 1024D / 1024D / 1024D).ToString("F1") & " GB"
End Function
Private Function ConvertToTerabytes(lngbytes As ULong) As String
Return (CDec(lngbytes) / 1024D / 1024D / 1024D / 1024D).ToString("F1") & " TB"
End Function
I got the following error but am perplexed why .NET thinks this DLL is located in the internet zone when clearly it is on the Intranet.
Here is the error NUNIT is throwing:
Unhandled Exception: System.TypeInitializationException:
The type initializer for 'NUnit.ConsoleRunner.Runner' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
[Code].....
I've got this assignment for my class and I need to assign a grade to each each student using a select/case statement and for some reason visual studio is making me put in extra code that doesn't make sense to me and the case statement doesn't even return a value for what i need. Here is the case snippet...
[Code]...
I want to create an object like the shape which is shown in the below picture. This picture is divided into different zones. I want to know how can I handle different events by clicking on different zones. For instance when the user click on zone 1 something is activated and when the user click on zone 2 another event is called.
View 5 RepliesI have some VB .NET software that interfaces to a load of old (but sound) COM objects. The VB provides a GUI for the COM objects, part of which consists of setting various options on the COM objects - several of which relate to string formatting.I have a simple pair of VB .NET functions that convert basic %f, %d, %g formats to/from .NET equivalents using a large select case covering specific common strings, but they don't cover all formats.[code]Before I start diving in and making it more versatile with some parsing, does anyone know of a class (eg VB or C# .NET) that provides a decent ready-made implementation? Or perhaps some regexp wizadry could be used?
View 2 RepliesWhat I am trying to do: There are three powershell scripts with different time delays as shown below.I am trying to run them asynchronously in .NET and I followed this article to implement Asyncrhonous programming. Where I am stuck:The I am not able to retrieve output after the events are invoked.The scripts are being called but then the program ends and it shows "Press any key to continue" in console windows.I don't what I am missing here.
Info: JobRequest is a class that I use to pass around information keep track of jobs.
Sub Main()
OurAsyncFunctionCalling("psDelayScript2.ps1", "-arg1 4 -arg2 5", 1)
OurAsyncFunctionCalling("psDelayScript1.ps1", "-arg1 2 -arg2 3", 2)[code]......
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Microsoft.VisualBasic.Interaction.Beep()
System.Diagnostics.Debug.WriteLine(3 + 2)
End Sub
Why I don't see in Output window number 5 as output?
I have trying to complete an assignment where I have to convert a string from user input to all different US time zones and then display them. At first I tried doing this just by using math but it seemed extremely inefficient and messy so I was told to use the DateTime function which seems easier with the exception of one thing - I have found absolutely no examples of converting time to different time zones. I was able to take the string and convert it to UTC time thinking it would make it easier but now I don't know how to convert them to PST, EST, MST, or CST. I included the function below:
Private Sub timeDifference()
Dim meridiem As String
Dim ante As String = " AM"[code].....
While I understand there are properties of MailItem that would allow one to programmatically create a formatted email, I would prefer the ability to copy the body of an email that is already formatted to my liking (bolding, italicizing, embedded pictures/tables, set margins, etc.) copy and paste it to a newly composed email such that this formatting is preserved.
View 4 RepliesI'm just going to throw all my code in here in case there's something wrong with a piece of the code not in the "SelectName()" sub.
Module Module1
Dim selectednames As String = ""
Dim index As Short = 0
Dim inarray As Boolean = False
[code]....
Here's an image of what it does (I suppose you can see what went wrong)13 inputs, 3 outputs expected, only 1 output given.As from what I've figured out so far, it's doing the correct amount of loops etc. It's just as soon as it starts generating the "winner" for the 2nd game key it doesn't get a string value from namesarray.Also, why is
For x = 0 To totalnames - 1
Debug.Print("namesarray(" & x & ") = " & namesarray(x))
Next
not giving me a debug output?
im using Trace to trace and debug my Application which works fine. Now i wanted to output my Trace Information to a text file like below:
Dim c As Integer = Console.ForegroundColor
Dim ts As TraceSwitch = New TraceSwitch("SPMassUploader-TraceSwitch", "")
Dim tw As New TextWriterTraceListener(Now.ToString("yyyyMMddHHmmssfffffff") & "-" & "output.txt")
Trace.Listeners.Add(tw)
[code]....
I have the following code, which generates insert queries
For Each f As String In Directory.GetFiles(d)
objSQLStringBuilder.Append("insert into table1 (full_path, file_name) values ('" & f.Replace("'", "''") & "', '" & f.Remove(0, Len(d) + 1).Replace("'", "''") & "');")
Next
However, the paths which it finds are formatted as follows
c:program filesmicrosoft officewinword.exe
I need to format the paths as follows
file:///c:/program%20files/microosoft%20office/winword.exe
How can I modify the above code to do this?
I have a Gridview that has a timestamp as one of the rows. When I read the data from the database the data is in the format( mm/dd/yyyy hh:mm:ss ). I've figured out how to format the way I want it which is just the ( mm/dd/yyyy ) and droping of the (hh:mm:ss) with the following code:
[Code]...
I have a Dynamic Fields comming from database. These fields populated on RichTextBox after changing the color.Means Different Fields in Different Color.
View 1 RepliesHow does the VB.NET compiler in this case determine which function is being called?
To me, it seems like it should raise an error because it CAN'T tell (or at least that's what it seems to me.)
Public Class Form1
[code]...
I just had a quick question about formating in currency in Visual Basic 2010 express. I already understand how to get it to work during runtime using the FormatCurrency feature, but I am wondering if there is a method to do it so that the user's input becomes currency instantly? (basically, is there a way to make the textbox always display as currency, rather than as a weird decimal?)
View 7 Replies