having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve.
having weird problem ,airline reserve. having weird problem ,airline reserve.
having weird problem ,airline reserve.
Go Back  Xtreme Visual Basic Talk > > > having weird problem ,airline reserve.


Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2010, 03:44 AM
wildguard wildguard is offline
Newcomer
 
Join Date: Jun 2010
Posts: 3
Default having weird problem ,airline reserve.


sorry if u had hard time to understand
i woke up at 4am posted and pasted from tic tac toe asc() it without even thinking. :S (btw i know how asc or chr works)
Now i have screen shot attached & code & rewrite my question


on screen shot
let's say i clicked 1A and inputbox will show tells you to enter name
it will greet you and shows you what seat you selected, A1 button will be disabled. which is all good
but once i check my text file "namessz.txt" (( i checked twice))
the first spot is still blank,,there should be "Anny" name i input it.

i have no idea what i need to fix it

FYI >VS2010


Code:
Public Class frmAirLine
    
    Dim count As Integer
    Dim OS As New Font("", 10, FontStyle.Strikeout)
    Dim newFont As New Font("", 18, FontStyle.Bold)
    Dim seat(40) As Button
    Dim user(40) As String


    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Declear Variables
        seat(1) = a01
        seat(2) = a02
        seat(3) = a03
        seat(4) = a04
        seat(5) = a05
        seat(6) = a06
        seat(7) = a07
        seat(8) = a08
        seat(9) = a09
        seat(10) = a10
        seat(11) = b01
        seat(12) = b02
        seat(13) = b03
        seat(14) = b04
        seat(15) = b05
        seat(16) = b06
        seat(17) = b07
        seat(18) = b08
        seat(19) = b09
        seat(20) = b10
        seat(21) = c01
        seat(22) = c02
        seat(23) = c03
        seat(24) = c04
        seat(25) = c05
        seat(26) = c06
        seat(27) = c07
        seat(28) = c08
        seat(29) = c09
        seat(30) = c10
        seat(31) = d01
        seat(32) = d02
        seat(33) = d03
        seat(34) = d04
        seat(35) = d05
        seat(36) = d06
        seat(37) = d07
        seat(38) = d08
        seat(39) = d09
        seat(40) = d10

        showall()



    End Sub


    Sub showall()
        Dim i As Integer
        Dim info As IO.StreamReader

        For i = 1 To 40
            AddHandler seat(i).Click, AddressOf Button_Click
            seat(i).Size = New Size(100, 40)
            seat(i).BackColor = Color.Green
            seat(i).Font = newFont
            seat(i).Text = "Open"
        Next
        'Open Text File
        info = IO.File.OpenText("lstname.txt")  'names
        If Not IO.File.Exists("lstname.txt") Then   'lstname
            MsgBox("NO FILE FOUND!")
        End If
        Do While info.Peek <> -1
            user(count + 1) = info.ReadLine()
            count = count + 1
        Loop

        For i = 1 To count
            If user(i) = "" Then
                seat(i).BackColor = Color.Green
                seat(i).Text = "Open"
            ElseIf user(i).Length >= 1 Then
                seat(i).BackColor = Color.Red
                seat(i).Text = "Reserved"
                seat(i).Enabled = False
                seat(i).Font = OS ' strikeout
            End If
        Next i
        info.Close()
        lstout.Items.Add("data loaded from file")



    End Sub

    Public Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'seat (1~40) as button
        Dim btn As Button = CType(sender, Button)
        'str = str&txtbox(i).text&';'
        Dim inputuser As String
        Dim output As IO.StreamWriter
        Dim str As String
        Dim row As Integer
        Dim col As Integer
        Dim SeatSelected As Integer

        inputuser = InputBox("Enter Your Name", "Passenger Name", )
        If inputuser.Length >= 2 Then
            MsgBox("Hi, " & inputuser & ". You have selected  Seat " & btn.Text & " , You have completed reservation")
            btn.Enabled = False
            btn.Font = OS ' strikeout
            btn.BackColor = Color.Red
            btn.Text = "Reserved"

         
       
            MsgBox(btn.Name)


            output = IO.File.CreateText("namessz.txt")
            For i = 1 To count
                output.WriteLine(user(i))
            Next i

            output.Close()

            MsgBox("No Error")
            Exit Sub
        End If
        showall()
        ''
    End Sub
Attached Images
File Type: jpg ss.jpg (181.6 KB, 7 views)
Attached Files
File Type: txt namess.txt (332 Bytes, 0 views)
File Type: zip airline_sys_reserve - Copy.zip (96.0 KB, 0 views)

Last edited by wildguard; 06-22-2010 at 01:12 PM. Reason: due to misunderstanding*
Reply With Quote
  #2  
Old 06-22-2010, 07:42 AM
AtmaWeapon's Avatar
AtmaWeaponhaving weird problem ,airline reserve. AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Could you please clarify your question? I'm having a hard time understanding what you are asking. Part is because your grammar is difficult to understand, but English might not be your first language so I can work around that. The other part is I'm not really sure what's going on.

It looks like you want to make an application that lets you click one of 40 buttons and assign a name to that position, and you'd like to save a file with the names the user entered. I'm not sure why you think the Asc() function has anything to do with this. Asc() is used to turn a single character into a number; it has nothing to do with the problem.

It also looks like you just sloppily pasted some code from a tic-tac-toe application into your code. Never use code without understanding it. If you're looking for a copy/paste solution I'm afraid I can't help you, because I prefer to teach people how to program.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 06-22-2010, 02:06 PM
AtmaWeapon's Avatar
AtmaWeaponhaving weird problem ,airline reserve. AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

*for those following along, the post was edited for clarification, leading to the need for a new answer*

Right now, your algorithm looks like this:
Code:
* User clicks button
* Ask for the user's name
* Temporarily store the user's name
* Write all names in the "users" array to the file
There's a step missing in that process. That step is "store the user's name in the "users" array". You need to figure out which button was pushed and store the user's name in the array. If it were me, I'd make the following changes ("..." means I'm skipping over some lines):
Code:
If inputuser.Length >= 2 Then
    ...
    btn.Text = "Reserved"

    Dim buttonIndex As Integer = Array.IndexOf(seat, btn)
    user(buttonIndex) = inputuser

    ...
This works by looking for the index of the button that was clicked in the seat array. It looks like the indices line up between the two arrays, so I'm assuming that if the first button is clicked you want the name in the first user slot.

There's far more elegant ways to implement this application, but that's not really the topic
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #4  
Old 06-22-2010, 04:51 PM
wildguard wildguard is offline
Newcomer
 
Join Date: Jun 2010
Posts: 3
Default

thank you very much , u'r the man!
i have other question,,
i added update button and remove user button
i keep getting error if update button is clicked, am i doing it right?
i basically copy from showall() but text file


Code:
 Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
    
        Dim i As Integer
        Dim info As IO.StreamReader

        For i = 1 To 40
            AddHandler seat(i).Click, AddressOf Button_Click
            seat(i).Size = New Size(100, 40)
            seat(i).BackColor = Color.Green
            seat(i).Font = newFont
            seat(i).Text = "Open"
        Next
        'Open Text File
        info = IO.File.OpenText("namessz.txt")  'names
        If Not IO.File.Exists("namessz.txt") Then   'lstname
            MsgBox("NO FILE FOUND!")
        End If
        Do While info.Peek <> -1
            user(count + 1) = info.ReadLine()
            count = count + 1
        Loop

        For i = 1 To count
            If user(i) = "" Then
                seat(i).BackColor = Color.Green
                seat(i).Text = "Open"
            ElseIf user(i).Length >= 1 Then
                seat(i).BackColor = Color.Red
                seat(i).Text = "Reserved"
                seat(i).Enabled = False
                seat(i).Font = OS ' strikeout
            End If
        Next i
        info.Close()
        lstout.Items.Add("data loaded from file")
    End Sub
Reply With Quote
  #5  
Old 06-22-2010, 11:57 PM
wildguard wildguard is offline
Newcomer
 
Join Date: Jun 2010
Posts: 3
Default

problem solved case close
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve. having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve. having weird problem ,airline reserve.
having weird problem ,airline reserve.
having weird problem ,airline reserve.
 
having weird problem ,airline reserve.
having weird problem ,airline reserve.
 
-->