## djjavo

Thanks for your reply, sorry to be a pain but I do not understand this code as I do not know ASP.net only VB.net

## djjavo Light Poster

Hi I am doing some coding with the WebBrowser element and was wondering if there was a way to create custom error pages i.e. if something goes wrong it navigates to this page instead of the default IE8 one. I did a quick google but got nowhere.

If anyone has any experience with this it would be fantastic. Cheers, I appreciate all contributions as always :)

## djjavo

Thanks codeorder, once again, I really apreciate the time you spend helping.

As for the date question, all I do is

[CODE]Dim raceDate As Date

Hope that helped you :).

As for the system, I have finished it now, your post gave me some good ideas and the text file is now formatted as {racedate, updated} so the program knows whether its updated that score just by a 1 or 0.

## djjavo

That is brilliant. Thank you for your help!! :) +1

## djjavo

Thank you both for your responses, unfortunatley I do not understand what you mean. I have tried both code suggestions but none seem to work as intended. Sorry for the hassle.

## djjavo Light Poster

Hi guys,
I have a total of 72 link labels on a form and I want them to do a similar task.
Is there a way to accomplishing this without writing each labels individual code?

Example function of the link label

variable = label1.text
End Sub

variable = label2.text
End Sub[/CODE]

## djjavo

If 2 dates passed, the scoring system would only record the most recent (because at the moment it executes ‘If gameweekdate < Now’. The same with 3 or more dates, it would only record the most recent.

Basically what I need is to have all the gameweek dates in a file (again generated and uploaded by me, not the program) so the program can reference them.
For example if 5 gameweeks have passed and the program last run on gameweek 2, the program would know that it hasn’t processed the scores for gameweeks 3-5, look them up in the scoreFile.txt and the process the according scores and add them to the users score.

Example scoreFile.txt after 5 gameweeks
[U][I]Format = PLAYER,POINTS FOR WEEK 1, POINTS FOR WEEK 2, POINTS FOR WEEK 3,etc.[/I][/U]

[CODE]Rooney,12,2,7,0,21
Lampard,1,17,12,4,2
Gerrard,16,8,19,1,3
Fabregas,12,19,13,1,11
Messi,7,2,4,6,8[/CODE]

The format of the date is DD/MM/YYYY
The data is added to the text file by myself, and then it get into the program by download from a web client in the program.

## djjavo

Doesn't seem to work, although you gave me some inspiration and I have solved the matter with a 3D array. Thanks :)

## djjavo Light Poster

Hi guys I have a standard scoring algorithm but I need to help on a piece of code to only execute the scoring algorithm at certain times.

I want it to be triggered by dates, but the problem arises if the program is used after 2 (or more) dates have passed, the first date will not be added as the second date is the newest and therefore the one that triggers the scoring algorithm.

Extra information:

• The scoring algorithm gets the scores for that week, which are stored in a text file.

Please could someone help with this problem. Thanks :)

## djjavo Light Poster

Hi guys

I am trying to declare a array within a structure, and it is not working. I'll paste the code below and if anyone can help it would be greatly appreciated.

[CODE]Structure league
Dim id As String
Dim name As String
Dim players(20) As String
End Structure

Dim leagues(100) As league[/CODE]

So I want each league to have a single name and id and 20 players.
Is there a way other than writing out dim player1, player2 etc.

## djjavo

Sorry I didn't realise I made this post. Thanks anyway, its works well. :)

## djjavo

Many thanks for this

## djjavo

Thanks Teme64, will try that. So when exported it will be relative to the current directory of the .exe file but while I'm still writing it, it will be relative to the current directory of the Visual Studio solution file?

I've also been told that I could try saving the stuff to the 'app data' folder. Do you know how I could do this?

Once again, thanks for you help.

## djjavo Light Poster

Hi

I am wondering how to point to a relative file that would be the same on all computers. How would I go about this.

Many Thanks

## djjavo

No I don't, all the data is stored in text files. I think I have found the solution, after line 12 you reset the counter back to 1.

Thanks anyway!

## djjavo

Ah ok, thanks, I thought of that, but thought there would be a quicker import/export option.

Thanks again! :)

## djjavo Light Poster

For my user system, I require each user to have a unique id. The reading in and saving of the user data is all done, but now I'm focusing on adding new users.

In my add user dialog, I have the information fields required to create a new user, one of which is the ID (which must be unique). For this I have created a function that I thought would always give a unique id but it does not. I'll paste the code below and hopefully you can tell me what I've done wrong!!

[CODE] Function getnextuserid()
Dim id As String
Dim unique As Boolean
unique = False
getnextuserid = 1
Do Until unique = True
For counter = 1 To maxsize
Debug.Print(getnextuserid)
id = userdata(counter).id
If getnextuserid = id Then
unique = False
getnextuserid = getnextuserid + 1
Else
unique = True
End If
Next
Loop
End Function[/CODE]

Many thanks, James

## djjavo

This works fine now. Sorry for the late reply.

Many thanks for that :)

## djjavo Light Poster

Hi, I'm coding my program on VB.net and I take my laptop when I am away and use my PC back at home. I know this may sound simple, but what is the easiest way to get the project on another PC. For example, in Java I know that you can export the project file for easy import on another computer but I have found no easy way for VB.net and Visual Studio. At the moment I've created a new project and pasted all the form elements and code. Please tell me there is a easier way!!! Is there something simple I'm missing?

Many Thanks

## djjavo Light Poster

Basically I use text files to hold the program data, which is loaded in to variables when the program starts.

I use StreamWriter to write to the text files when they update within the program. This is fine although the writer adds a extra line when I do not want this, which causes the program to error on the next use.

This is what I mean:
[CODE]For x = 1 to 4
FileWriter.WriteLine(user(x) & "," & pass(x))
Next[/CODE]

Comes out as (the text doesn't matter here)

'line1
'line2
'line3
'line4
| <---- but the cursor goes here making the application think that there is a extra line of data which there isn't hence causing it to error.

I also use the 'how many lines in the file' as a variable in various parts of my program.

Please could someone shed any light on this issue.
Many Thanks :)

## djjavo

I'm not sure if this is what you are wanting, but I'll give it a try ;)

[CODE]Dim password As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = password Then
NextForm.Show()
Me.Hide()
Else
End If
End Sub[/CODE]

That does the trick for me and I hope it works for you :D

## djjavo

unfortunately the suggested code does not work :(

just to clarify i have 24 pictureboxes and would like to do that case statement on all of them. i currently have it working as i wrote each one out individually but if you could do one case statement when all 24 pictureboxes follow that it would be alot quicker to write ;)

thanks again!

## djjavo

Many thanks, this is perfect. :)

One last thing, I hope I'm not being a pain, but do you know of a way to make each character different, but the computer knows how to distinguish which letters are what and so on. For example, the password hello, could this be encrypted so that the l's have a different character and hence it makes it harder to crack.

If not, no worries you've been a massive help, thank you.

## djjavo

That is actually really helpful :)

Sorry to jump in on someone else's thread but could you show me a way of encryption which is still easy (ish!) to write but a bit more secure. So maybe a level or two up from this encryption?

This would be amazing if you could. Many thanks!

## djjavo Light Poster

Ok so I am creating this scoring game using motorsport drivers.

The scores are in variables for example score.vettel is vettels score for the current gameweek.

A player has 6 drivers d1,d2,d3,d4,d5,d6 which are in the variable player(x).d1 where x is the player number. Maxsize is the number of players I have (so it loops from the first user to the last)

[CODE]For x = 1 To Maxsize
If player(x).d1 = "VETTEL"
Then player(x).score = player(x).score + score.vettel
End If
Next[/CODE]

Of course I would have to do this loop for all drivers in all driver slots (d1,d2,d3,d4...)

[CODE]For x = 1 To Maxsize
If player(x).d2 = "VETTEL"
Then player(x).score = player(x).score + score.vettel
End If
Next[/CODE]

Is there any way to make it so that I do not have to write all of this code but shorten it to something like:

[CODE]
For x = 1 To Maxsize
If player(x).d1 - player(x).d6 = "VETTEL"
Then player(x).score = player(x).score + score.vettel
End If
Next[/CODE]

Many thanks

## djjavo Light Poster

Hi

I know there are some posts addressing the same issue but unfortunately I do not understand how to do it and was wondering if someone could help.

I would like to cycle through pictureboxes, in this example using the 'n' variable
To further explain what I would like to do, I need the n to be the same for the array as the picturebox number, looping from 1 to 24, and depending on what data is in that array, controls what picture the corresponding picturebox displays.

I know this code won't work, but this is me trying to demonstrate what I need to happen.
Also the file paths are not correct, as this is just for demonstration purposes.

[CODE]
Dim n As Integer
For n = 1 To 24
Select Case f1data(n).countries
Case "GER"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\de.gif")
Case "AUS"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\au.gif")
Case "GBR"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\gb.gif")
Case "ESP"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\es.gif")
Case "BRA"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap(\bin\flags\br.gif")
Case "RUS"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\ru.gif")
Case "VEN"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\ve.gif")
Case "JPN"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\jp.gif")
Case "MEX"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\mx.gif")
Case "CHE"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\ch.gif")
Case "FIN"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\fi.gif")
Case "ITA"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\it.gif")
Case "IND"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\in.gif")
Case "BEL"
Form2.PictureBox[COLOR="Green"]n[/COLOR].Image = New System.Drawing.Bitmap("\bin\flags\be.gif")
End Select
Next[/CODE]

If you have a solution for me that would be fantastic.

Cheers

## djjavo

That works a dream.
Thank you very much, it is much appreciated :)

## djjavo Light Poster

Hi
Am new to this and was wondering if anyone knew a solution to this problem.

I am wanting to get information from a text file into different arrays.

My current text file has a new line for each driver but I would like it to look something like this:

Hamilton,Button,Alonso,Massa,Webber,Vettel
Di Resta,Sutil,Rosberg,Perez,Buemi,Glock

Each line of the text file represents a player and each player has 6 drivers.
Each driver is seperated by a comma (,) which is what I need the program to understand.

So for example I would want to import 'player one' drivers into the array:
playerdrivers(1,1) - playerdrivers(1,6)
So (1,1) would be Hamilton (1,2) would be Button and so on.
Player two and further players would have a different first number e.g (2,1) (3,1)

This code I have written but does not work as it tries to convert from string to double.

[CODE] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim playerdrivers(4, 6) As Array
Dim destination As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/f1data/bin/array.txt"