Tuesday, February 22, 2011

2 Simple VB6 Projects

So I chucked together a few vb6 projects for beginners that were intended for the Mildura Programmers group of Facebook.

First is an example of how to search and replace text inside a string.
Private Sub Command1_Click()
Dim strOrg
Dim strSrch
Dim strReplace
Dim strOutcome
strOrg = Original.Text
strSrch = Search.Text
strReplace = Replace.Text
If InStr(1, strOrg, strSrch) > 0 Then
strOutcome = Replace(strOrg, strSrch, strReplace)
MsgBox strOutcome
End If
End Sub
http://rapidshare.com/files/449320589/str-search-and-replace.rar

Second is a simple Telnet client using Winsock.
Private Sub cmdConnect_Click()
wskConnect.RemoteHost = txtHost.Text
wskConnect.RemotePort = txtPort.Text
wskConnect.Connect
End Sub

Private Sub cmdSend_Click()
wskConnect.SendData (txtInput.Text & vbCrLf)
txtInput.Text = ""
End Sub

Private Sub For...m_Load()
MsgBox "J. Ben Ross :: 2011"
End Sub

Private Sub Form_Unload(Cancel As Integer)
wskConnect.Close
End Sub

Private Sub wskConnect_Close()
lblStatus.Caption = "Disconnected"
End Sub

Private Sub wskConnect_Connect()
lblStatus.Caption = "Connected!"
End Sub

Private Sub wskConnect_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
wskConnect.GetData strData, vbString
    txtPackets.Text = txtPackets.Text & strData & vbCrLf
End Sub

Private Sub wskConnect_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "There was an error"
wskConnect.Close
End Sub

http://rapidshare.com/files/449320563/PrjTelnet.rar

Thursday, February 10, 2011

So eh First Post :]

As I sit outside having a smoke, looking in the other direction of where my cigarette packet sits because of the ever so graphic generic packaging , I notice the distant sound of water falling over the weir situated at Lock 11 on the great and mighty Murray River. I'm thinking over the current train of thought that I've had the last few days. My distant memories of last winter and summer and the activities and time spent with other people, generally having fun, seems more rich in emotion and happiness than actually living the memory.  Its a new thing I've only came to realize a few days ago and it certainly intrigues me!
My thoughts dart to the car I have sitting up near the back fence, when am I going to get off my lazy ass and finish this somewhat minor project and get on with getting it registered (which in new south wales is a rather fucking hard, annoying and expensive task) I think I may as well try in Victoria, but Ive thought all this before and still haven't done anything.
My thoughts go to what am I going to do for the day tomorrow, I really should go and sign up for them short courses at the local community college so I can start or well at least try a new job, tired of the current job and forced to try new things because work has slowed down alot as the vineyard I am working on and maintaining has been brought upto almost entirely 21st century standard
I'm reminded that its vintage almost everyday driving past 2 wineries the reak of what I think is sulfur, but really smells like urine or animal urine, they really should position these factories strategically so that the wind carries the smell away, but I suppose where the wineries are located is far away from any houses or residential areas.
After all this smell is only around for a month and a bit and once every year,  Its usualy dictated by the temperature and weather. But there is still a highway that runs between the two and everyone, locals going to Mildura or further, tourists visiting the outlying regions and towns of Wentworth and Coomealla, and practically every truck, car or bus that travels to broken hill or to anywhere near that place full of people suffering from lead poisoning making it literally Australias biggest hole. But the discussion of the lead and lead poisoning and greater ethical and humanitarian issues on this subject (that the locals lack the ability of seeing) is another story for another day!
~Yumashi