|
Oh yeah, sorry, the first line added to the lstbox the strings should be passed. After that the variable data read from the text file should be passed.
|
|
|
|
|
bjk88 wrote: lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
You can't use string values with a format that expects numeric values.
bjk88 wrote: won = sr.ReadLine
This is an implicit conversion equivalent to:
won = Convert.ToInt32(Double.Parse(sr.ReadLine))
This might not be exactly what you want. You might rather want to use Option Explicit On (to avoid unintended conversions), and do the conversions youself, so that you see what actually happens.
bjk88 wrote: lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
You haven't assigned any value to the perc variable.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: You can't use string values with a format that expects numeric values.
How would i go about changing it so it would accept the values?
|
|
|
|
|
bjk88 wrote: How would i go about changing it so it would accept the values?
"{0, -15}{1, 10}{2, 8}{3, 8}{4, 8}{5, 8}{6, 20}(7, 20}{8, 8}"
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: "{0, -15}{1, 10}{2, 8}{3, 8}{4, 8}{5, 8}{6, 20}(7, 20}{8, 8}"
I changed to that, but still get the same error.
|
|
|
|
|
Change (7, 20} to {7, 20} .
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
That has worked. Thanks a lot!
Now getting an error at the next lstbox.Items.Add line.
"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
|
|
|
|
|
Check the arguments in the call, and add the one that is missing.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Ive added the one that is missing.
|
|
|
|
|
The code now looks like this:
Public Class Form1
Private Sub btnOutput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutput.Click
'Declare variables
Dim team As String
Dim played, won, drawn, lost, points, aveA, aveI, perc As Integer
'Create "zones" for data
Dim fmtStr As String = "{0, -15}{1, 10:N0}{2, 8:N1}{3, 8:N2}{4, 8:N3}{5, 8:N4}{6, 20:N5}{7, 20:C}{8, 8:P0}"
'Read data from football.txt
Dim sr As IO.StreamReader = IO.File.OpenText("C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Assessment2\football.txt")
'Add headers to the table
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
team = sr.ReadLine
won = CInt(sr.ReadLine)
drawn = CInt(sr.ReadLine)
lost = CInt(sr.ReadLine)
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = CInt(sr.ReadLine)
aveI = CInt(sr.ReadLine)
perc = (won / played) * 100
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
sr.Close()
End Sub
End Class
With the error appearing in the highlighted line.
|
|
|
|
|
See my previous post.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
hi all
i have download one project in vb6 and i have also convert in to vb.net but there is one problem Me.Line
this is the code in vb6
Sub AngleLineXY(ByRef X As Single, ByRef Y As Single, ByRef LineLength As Single, ByRef Angle As Single, ByRef LineID As Short, Optional ByRef Color As Short = 0)<br />
Dim X1 As Single<br />
Dim Y1 As Single<br />
Dim X2 As Single<br />
Dim Y2 As Single<br />
<br />
X1 = CenterX + X<br />
Y1 = CenterY + Y<br />
X2 = CSng(X1 + (System.Math.Cos(Angle - Radians(90)) * LineLength))<br />
Y2 = CSng(Y1 + (System.Math.Sin(Angle - Radians(90)) * LineLength))<br />
<br />
'UPGRADE_ISSUE: Form method Main.Line was not upgraded. Click for more: 'ms-help:
Me.Line (X1,Y1)-(X2,Y2)<br />
Me.Line (X1,Y1)-(X3,Y3)<br />
<br />
AL(LineID).X1 = X1 - CenterX<br />
AL(LineID).Y1 = Y1 - CenterY<br />
AL(LineID).X2 = X2 - CenterX<br />
AL(LineID).Y2 = Y2 - CenterY<br />
<br />
CurLineID = CShort(CurLineID + 1)<br />
End Sub
so how can i change this
this project is for rotate 3d qube i am new in vb.net and i just want to create 3d qube with rotation
any help
please
|
|
|
|
|
Have you checked what the help article that the code references has to say?
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
you need to handle your forms paint event and then use the graphics object passed in there to draw lines
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I hope I'm posting this on the right board;
Using VB6 & Win 98, I spent many days trying to make an old (cash register) program I wrote many years ago talk. ie; "two at three dollars and twenty-five cents each", "Total due is" , "Your change is", etc. I had little or no success. One member suggested I up-grade my OS & up-grade from VB6 to VB.NET. I did up-grade to Win XP Pro & will try to learn VB.NET later.
Still trying to accomplish my goal, I purchase several third-party APIs (Alive Text to Speech, TextSound, & TextAloud) at a cost of $25 to $29 each. They all had problems and wouldn't work for me. I sent numerous e-mails to their support address for help. I got zero response from "Alive Text to Speech" & "TextSound". I did get immediate response from "TextSound". "TextSound" was NOT able to help me with my problem which turned out (according to their forum) to be shared by other users of their application. Additionally, "TextSound" wanted an additional $250 for a developers license if I wanted to use their command line feature for more than 30 days. Since it wouldn't work for me anyway, this discussion became mute.
About to give up, I decided to download the free SDK5.1 (Speech Development Kit) from Microsoft. Only having dial-up this took 4 hours. Boy, was it worth it!
Not only did the download come with several complete sample speech projects, they all compiled & ran on VB6. Even better yet, they all had complete, well commented source code. After getting this download, I had my old program running & talking perfect in about 45 minutes.
I hope this might be helpful to someone.
Robert, still trying
|
|
|
|
|
Robert from Florida wrote: this discussion became mute.
you mean moot ?
Robert from Florida wrote: About to give up, I decided to download the free SDK5.1 (Speech Development Kit) from Microsoft. Only having dial-up this took 4 hours. Boy, was it worth it!
Yeah, as I was reading, I wondered why no search you did brought this up.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Actually I want to display the Amount of Available Memory and CPU Usage and also its history on Screen just like one on Task Manager. So far I am able to display the Available Memory on Screen by using a Performance Counter under Memory Category "Available KBytes". But how can i display the CPU Usage and its History. I am using the "% Processor Time" Performance counter but can't see anything happening on screen. What should i use for this purpose. Thanks for your cooperation !
AliAmjad(MCP)
|
|
|
|
|
Would you care to show the code that you are using for the PerformanceCounter class? It sounds like it ought to be working. I've done this numerous times in the past and it works.
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
I am using the RawValue Property of "Available KBytes" Performance Counter and also used the same one for "% Processor Time" under a Timer which updates the Text of the Label after every Second But I Get always a '0' for "% Processor Time" is there any other way of using this counter and also what about the real time graph how can i display it on screen.
AliAmjad (MCP)
|
|
|
|
|
Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
Paul Conrad wrote: Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
Yes i am getting values. But not on the form. I have actually created a new category and then created a copy of "% Processor Time" performance counter in it. What else should i do?
AliAmjad (MCP)
|
|
|
|
|
Ok I've found the Solution for this Problem I am using the following Code now:
Dim CPULoadCounter As New PerformanceCounter
Private Sub tmrUsage_Tick(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles tmrUsage.Tick
Dim lCPULoadCounterNextValue As Single = CPULoadCounter.NextValue()
Me.lblCPULoad.Text = CType(lCPULoadCounterNextValue, Integer) & "%"
End Sub
Private Sub CPULoadCounterInitializer()
CPULoadCounter.CategoryName = "Processor"
CPULoadCounter.CounterName = "% Processor Time"
CPULoadCounter.InstanceName = "_Total"
End Sub
Can you please tell me how can i get the Total Physical RAM Size in VB.NET?
AliAmjad (MCP)
|
|
|
|
|
AliAmjad wrote: Can you please tell me how can i get the Total Physical RAM Size in VB.NET
I have found its solution too here it is:
My.Computer.Info.TotalPhysicalMemory
Thanks man for your cooperation !
AliAmjad (MCP)
|
|
|
|
|
why VB 2005 doesn't allow subreport on its integrate report object..
|
|
|
|
|
My input text from a .txt file is
this is the first line
this is the second line
this is the third line
I need to capitalize the first letter of each word by placing it in a textbox, I have the following code:
Dim aString As String = My.Computer.FileSystem.ReadAllText("input.txt")
Dim stringReturn As String
If My.Computer.FileSystem.FileExists("input.txt") Then
Me.xInputTextBox.Text = (Convert.ToString(aString.ToLower))
End If
Do While (aString.IndexOf(Space(2)) >= 0)
aString = aString.Replace(Space(2), Space(1))
Loop
Dim caparray() As String = (aString.Split(" " & "ControlChars.NewLine"))
For I As Integer = 0 To caparray.Length - 1
If caparray(I).Length = 1 Then
caparray(I) = caparray(I).ToUpper
Else ' ***join them back together
caparray(I) = caparray(I).Substring(0, 1).ToUpper & caparray(I).Substring(1).ToLower
End If
Next
stringReturn = String.Join(" ", caparray)
Me.xInputTextBox.Text = (stringReturn.ToString)
My output is then
This Is The First Line
this Is The Second Line
this Is The Third Line
It will not capitalize the first letter of the second and third line. Can someone please tell me what I am doing wrong?
Thanks, Jesi
|
|
|
|
|