Making editors for cricket games

Drewska said:
Embi, i'll your tutorial soon as i'm just downloading Visual Basic now, it looks good :).

Btw, Colin, where is the start of the tutorial your doing now?

Just above. There are a couple of posts inbetween.
 
Looking good,It pretty basic stuff again so it shouldnt be that tough to grasp and then (hopefully) build on.Good work Colin,you can explain them very well.
 
Great, thanks Drewska. Now there is some interest I'll probably finish it later. It might get a bit confusing in here with Colin's one going on, I might compile a list of all the tuts in this thread later.

OK, heres a list of all the tuts:


Colins introduction and message box program
Rating: Very Easy!

Colins second program: Cricket scorecard
Rating: Easy!

Embi's first introduction to variables
Rating: Medium

More programming basics from Embi (Functions, Subs, Properties)
Rating: Medium

Embi's text editor
Rating: Medium



Colin's Multiple abilities changer Part 1
Colin's multiple abilities changer Part 2
Colin's Multiple Abilities Changer Part 3
Rating: Looks complicated. Medium.

Damn,this thread looked popular when you first started it. Be good to get some of those people back, but how?

EDIT: Feel my sig needs a change. Am OK at using graphics programs, be good if others put it in their sig. ;)
 
Last edited:
Sure, will do later. Soz, must have missed it. Could you find a link? Gotta go to school now :(

Check out the sig! Doesn't need any photoshopping, looks effective enoguh already.
 
embi said:
Sure, will do later. Soz, must have missed it. Could you find a link? Gotta go to school now :(

Check out the sig! Doesn't need any photoshopping, looks effective enoguh already.

oh ok sorry,youve included it already.
 
Hi guys,
Sorry for not doing some of the tutorials but i have learnt some basics of VB.NET and was able to make a project on my own. It is a calculator, it can also calculate the areas, volume and surface areas of some shapes. You can download and see it.
 

Attachments

  • Vb.JPG
    Vb.JPG
    64.9 KB · Views: 80
  • VBProject.zip
    110.5 KB · Views: 16
Last edited:
Wow, looks pretty sophisticated. Well done.
Barmyarmy, do you think it would be possible to keep an updated list of tutorials (with links) on the first post? It would save having everyone who visits this thread having to wade through all the replies.
 
Embi, is there any chance of you finishing your tutorial today? Because just opening stuff is boring :).
 
Sure is :). Just gonna sort it out. Will post asap.

After, I might do a tutorial on manipulating text, i.e. searching for things in it, sorting it, and even maybe encrypting it (will not be priority).

1. Double click the Save button we created in the previous tutorial.

2. Add a SaveFileDialog to your form. Just like OpenFileDialog. Call it dlgSave.

3. Now we need to type this (well you will copy and paste :) ). If you want to try and understand what it means, then feel free to take your time looking at the comments...
Code:
        'Store the text we want to put in the file in a variable
        Dim input As String
        input = txtFile.Text

        'Show the dialog, its just like the OpenFileDialog.
        dlgSave.ShowDialog()

        'If user pressed cancel, the filename will be empty. This will cause errors, so:
        If dlgSave.FileName <> "" Then

            'Open the file. This time, we use OpenMode.Output because we are outputting data to the file.
            FileOpen(1, dlgSave.FileName, OpenMode.Output)

            'now simply output using printline to the file:
            PrintLine(1, input)

            'Close the file. This is an important step - if we dont do it errors will come up.
            FileClose(1)

        End If

Now run the program. Open something, then change it and click save. Type a filename to save to.

Uh oh! Comes up with an error:
032320061637086pt.png


It says "File already open" (lol). This means that we forgot to close the first file! (my mistake :D but it gives us a chance to find errors)

Click "Continue".
Find the code for the first button. Underneath "Loop", put the following code:

Code:
FileClose(1)

Thats enough from me. Have a fiddle aroudn with that. Im really tired and not really wanting to do another tutorial, will write one by Sunday.
 
Can someone give me some help about saving stuff? When i save it it makes about 5 files when i only want one.
 
WTH? Check all the code is correct. Heres what you should have added (this works fine on my pc) :

Code:
    Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        Dim AllText As String
        Dim LineOfText As String
        dlgOpen.ShowDialog()

        'If user pressed cancel, the filename will be empty. This will cause errors, so:
        If dlgOpen.FileName <> "" Then
            'Open the file
            FileOpen(1, dlgOpen.FileName, OpenMode.Input)

            'Loop through these instructions until we reach the End Of File
            Do Until EOF(1)
                'Get the next line from the file
                LineOfText = LineInput(1)

                'Add this line on to the end of the Alltext variable (with a new line- vbCrLf)
                AllText = AllText & LineOfText & vbCrLf
            Loop

            FileClose(1)

            'Display the file in the textbox
            txtFile.Text = AllText

            'Extra bonus bit. select the file
            txtFile.Select(1, 0)
        End If
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        'Store the text we want to put in the file in a variable
        Dim input As String
        input = txtFile.Text

        'Show the dialog, its just like the OpenFileDialog.
        dlgSave.ShowDialog()

        'If user pressed cancel, the filename will be empty. This will cause errors, so:
        If dlgSave.FileName <> "" Then

            'Open the file. This time, we use OpenMode.Output because we are outputting data to the file.
            FileOpen(1, dlgSave.FileName, OpenMode.Output)

            'now simply output using printline to the file:
            PrintLine(1, input)

            'Close the file. This is an important step - if we dont do it errors will come up.
            FileClose(1)

        End If

    End Sub

How could it make 5 files? It should overwrite them if the same filename is used. See if you can get a screenie, its strange.
 

Users who are viewing this thread

Top