I'm writing a console application. I used the FileOpen method to open the .txt file and read in the information I needed. But I've tried everything and I can't figure out how do a count of the numbers in the file. Can someone please help?
Three answers:
texasmaverick
2011-04-30 06:02:34 UTC
Assuming you read the text file into a multiline textbox, the following code will probably work. The form requires 2 textboxes (TextBox1 for the text from the text file) and a button.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim String1,String2 As String
Dim Num As Integer=0
String1 = TextBox1.Text
For Z = 1 To Len(String1)
String2 = Mid(String1, Z, 1)
If Asc(String2) > 47 And Asc(String2) < 58 Then
Num=Num+1
End If
Next
TextBox2.Text=Num
End Sub
End Class
TexMav
bolt
2016-11-19 06:07:21 UTC
application is everywhere. a number of that is on your face graphical, like video games. some application is hidden away, like interior the engine administration gadget of your motor vehicle. some is in between, like the appliance working at Yahoo! that introduced this web page to you. Console purposes tend to be application that in simple terms get on and do their activity. The C++ compiler, for occasion, is a console application. counting on the IDE you utilize there'll be a view someplace which you will discover the compiler introducing itself, telling you what that is doing and spitting out lawsuits bearing directly to the errors on your software. The IDE will then map the errors from the console application into the unique text textile. i'm a professional application developer working close to the bleeding fringe of technologies and that i oftentimes write the two GUI and Console based application, the two with C++ and extra present day languages. This week my time has been incredibly calmly divided via three products of application, one with a GUI, one a console application and yet another that is embedded interior of another application and so purely has a binary interface.
Mike C
2011-04-29 20:36:52 UTC
I think it would be a good start to list what you tried exactly. Obviously you could not have tried "everything", otherwise you would have found the solution. ; )
And also because I doubt anyone will try to help you unless you specifically say what you tried.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.