473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Text file not displaying when I run my program

I'm creating a diving competion program that

1. keeps score for up to 16 divers.

2. Each diver has 8 dives.

3. There are 8 judges scoring each dives w/scores ranging from 0-10 w/one decimal place.

4. Each dive has a degree of difficulty from 1-4 w/two decimal places.

5. To get their final scores, throw-out the highest & the lowest and then add the remaining 6 and multiply by the degree of difficulty.

The problem I'm running into is that the text file with the names of the divers isn't showing up when I run the program so that I can pick a name from the list.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3.         Dim dt As New DataTable
  4.         dt.Columns.Add(New DataColumn With
  5.             {.ColumnName = "Identifier", .DataType = GetType(Int32), .AutoIncrement = True})
  6.         dt.Columns.Add(New DataColumn With
  7.             {.ColumnName = "Description", .DataType = GetType(String)})
  8.         dt.Columns.Add(New DataColumn With
  9.             {.ColumnName = "Factor", .DataType = GetType(Decimal)})
  10.         dt.Rows.Add(New Object() {Nothing, "Bellyflop", 4D})
  11.         dt.Rows.Add(New Object() {Nothing, "Canonball", 2D})
  12.         dt.Rows.Add(New Object() {Nothing, "Back Flying Somersault", 3D})
  13.         dt.Rows.Add(New Object() {Nothing, "Back Flying 2 1/2 Somersault", 3.56D})
  14.         dt.Rows.Add(New Object() {Nothing, "Reverse Dive", 3.52D})
  15.         dt.Rows.Add(New Object() {Nothing, "Inward Somersault", 3.36D})
  16.         dt.Rows.Add(New Object() {Nothing, "Inward 1 1/2 Somersault", 3.54D})
  17.         dt.Rows.Add(New Object() {Nothing, "Forward Dive 1/2 Twist", 3.51D})
  18.         ListBox1.DisplayMember = "Description"
  19.         ListBox1.ValueMember = "Factor"
  20.         ListBox1.DataSource = dt
  21.         Label1.DataBindings.Add("Text", dt, "Factor")
  22.         ListBox1.Items.LoadFromFile("Names.txt")
  23.     End Sub
  24.  
  25.     Private Sub ListBox1_SelectedIndexChanged(
  26.         ByVal sender As System.Object,
  27.         ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
  28.         Console.WriteLine("Factor {0}", CDec(ListBox1.SelectedValue))
  29.     End Sub
  30.  
  31.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  32.         Dim ScoreSum =
  33.             (
  34.                 From T In Me.Controls.OfType(Of NumericUpDown)()
  35.                 Select T.Value).Sum / CDec(ListBox1.SelectedValue)
  36.         TextBox1.Text = ScoreSum.ToString("n2")
  37.     End Sub
  38. End Class
  39.  
  40. Module Module1
  41.  
  42.     <System.Runtime.CompilerServices.Extension()> _
  43.     Public Sub LoadFromFile(
  44.         ByVal sender As ListBox.ObjectCollection,
  45.         ByVal FileName As String)
  46.         sender.AddRange(IO.File.ReadAllLines(FileName))
  47.     End Sub
  48.  
  49. End Module
May 17 '13 #1
0 1200

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Frank Maestas | last post by:
Hello, I have a company MySQL database containing e-mail addresses. Some of these addresses are bad. I have a text file with the addresses I need to remove from the MySQL database. Is there a...
4
by: Jesper | last post by:
How can I open a textfile from C# using notepad (or the user assigned application for this).
2
by: Cleako | last post by:
I am writing a program that formats the data and prints it to a text file. I know that a text file wont hold the form feed and recognize it but what is an ideal way to get a new page? Would it...
2
by: Murali | last post by:
Hello Everyone, I am breaking my head with this problem. Please help me out. Let me first explain my problem : Here it is: I am working in realtime environment where i will be creating...
4
by: Brad | last post by:
I have a file that downloaded a CSV file for the user based upon some information gathered from the Database. My file was working fine until recently (I believe that my hosting company did...
13
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them...
1
by: vincec | last post by:
Hi need some help from you guysin using visual C++. I am thinking of opening a text file after some calculation. For example, after i press the "calculation", then at the OnCalculation function, it...
3
by: manontheedge | last post by:
I'm having a problem when I work with Access using VB6. I don't have a problem controlling Access, but I want the Access file to stay open when the program ends...but it always closes itself, and I...
1
by: Joe Strout | last post by:
On Nov 19, 2008, at 3:27 PM, Mohsen Akbari wrote: Appears that way where? Using what tool to view it? My guess is that there is nothing wrong with the file, but that whatever you're using...
0
by: Matthew Barnett | last post by:
Steve Holden wrote: 20 Some text editors can display very long lines, others can't and just wrap them when displaying. Notepad can't.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.