Just got sick of seeing product requester that are at like v 6 or 7, with all that is being updated is the products and/or coders. Just made this, it is a basic example of how to do it with a ftp/website/whatever...I commented as much as I thought was needed, fairly simple but great for expansion into your own projects.
Gives a "Remote Controlled" feel to the program, being able to manage coders, products and whatever you choose to be expanded without having to update your program all you have to do is update your text files on your server...Any problems or questions just ask.
Code:
' Basic Demonstration of a Product Requester
' "Remote Controlled"
' By FreckleS
Imports System.IO
Public Class Form1
Dim Coder As String ' Used for telling us // Not needed
Dim Product As String ' Used for telling us // Not needed
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DownloadFiles() ' D/L all files
ReadFiles("coders.txt", "Coders") ' Read coders.txt and control is cmbCoders
End Sub
Sub ReadFiles(ByVal file As String, ByVal control As String)
Dim read As New StreamReader(file) ' Setup StreamReader
Do Until read.EndOfStream ' Stuff left
Select Case control ' Multiple Selection
Case Is = "Products"
cmbProduct.Items.Add(read.ReadLine) ' Use cmbProduct
Case Is = "Coders"
cmbCoders.Items.Add(read.ReadLine) ' Use cmbCoders
End Select
Loop ' ^^
End Sub
Sub DownloadFiles()
' Download all the files
If File.Exists("coders.txt") Then
File.Delete("coders.txt")
Else
End If
My.Computer.Network.DownloadFile("http://freckles.etsoldiers.com/loader/coders.txt", "coders.txt")
If File.Exists("FreckleS.txt") Then
File.Delete("FreckleS.txt")
Else
End If
My.Computer.Network.DownloadFile("http://freckles.etsoldiers.com/loader/FreckleS.txt", "FreckleS.txt")
If File.Exists("Toxic.txt") Then
File.Delete("Toxic.txt")
Else
End If
My.Computer.Network.DownloadFile("http://freckles.etsoldiers.com/loader/Toxic.txt", "Toxic.txt")
If File.Exists("C0d3r.txt") Then
File.Delete("C0d3r.txt")
Else
End If
My.Computer.Network.DownloadFile("http://freckles.etsoldiers.com/loader/C0d3r.txt", "C0d3r.txt")
End Sub
Private Sub cmbCoders_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbCoders.SelectedIndexChanged
' When selection changes then change cmbProduct's items
Coder = cmbCoders.Text
cmbProduct.Items.Clear()
ReadFiles(cmbCoders.Text & ".txt", "Products") ' Fill cmbProduct depending on cmbCoders.Text value
End Sub
Private Sub cmbProduct_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbProduct.SelectedIndexChanged
Product = cmbProduct.Text
End Sub
Private Sub btnBuy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuy.Click
MsgBox("You bought: " & Product & " By " & Coder) ' Tell us // Useless
End Sub
End Class
Hope you enjoyed it
Feel free to use however credits though please.