Tämä on Vb:llä tehty uutis systeemi. Admin ohjelmalla lisätään uutinen ja client ohjelmalla luetaan se.
Admin ohjelmaan:
Text1, Inet1, Command1 ja Command2
Client:
Text1, Inet1, Command1 ja Command2
Bugit korjataan, kun huomautatte niistä!
Client
Private Sub Command1_Click()
Inet1.AccessType = icUseDefault
'Tähän tulee ftp servun osoite, tunnus ja salasana
Inet1.URL = "ftp://"
Inet1.UserName = ""
Inet1.Password = ""
Inet1.RequestTimeout = 40
'Otetaan uutinen servulta:
Inet1.Execute , "GET uutiset.txt C:\uutiset.txt"
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute , "CLOSE"
MsgBox "Uutinen noudettu!"
End Sub
Private Sub Command2_Click()
'Avataan uutinen ja näytetään se.
Open "C:\uutiset.txt" For Input As #1
Text1.Text = Input(LOF(1), 1)
Close
End SubAdmin
Private Sub Command1_Click()
'Avataan uutinen ja muokataan sitä
Open "C:\uutiset.txt" For Output As #1
Print #1, Text1.Text
Close #1
End Sub
Private Sub Command2_Click()
Inet1.AccessType = icUseDefault
'FTP servun tiedot tähän:
Inet1.URL = "ftp://"
Inet1.UserName = ""
Inet1.Password = ""
Inet1.RequestTimeout = 40
'Päivitetään uutinen:
Inet1.Execute , "PUT C:\uutiset.txt \uutiset.txt"
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute , "CLOSE"
MsgBox "Uutinen päivitetty!"
End SubAihe on jo aika vanha, joten et voi enää vastata siihen.