Winanjaya Posted September 16, 2003 Posted September 16, 2003 Dear The Expert, I need to create custom event that will automatically executed when the event occurs? is it possible to do this in VB.NET? ..if Yes ..could any body please help me how to do this? many thanks in advance Regards Winan Quote
Administrators PlausiblyDamp Posted September 16, 2003 Administrators Posted September 16, 2003 What kind of 'Custom Event'? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Winanjaya Posted September 16, 2003 Author Posted September 16, 2003 Regarding to my previous posts.. for example to create custom read event for tcplistener and refreshing the datagrid? .. I need the read event for tcplistener, this will automatically executed when a strings received .. and for datagrid control .. for determine when the new record added or a record modified to a table .. .. is it possible? .. many thanks Winan Quote
AndreRyan Posted September 17, 2003 Posted September 17, 2003 Do you mean: Public Event DataArrived() To make an event? In order to get a TcpClient to check for data you'll need to use: If MyTcpClient.GetStream.DataAvailable = True Then RaiseEvent DataArrived Put the above code in a Polling function and call it in a loop or a Timer Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Winanjaya Posted September 17, 2003 Author Posted September 17, 2003 Sorry .. I am very new with VB.NET ..what do you mean by Polling function .. could you please explain more detail ? many thanks in advance Regards Winan Quote
Winston Posted September 17, 2003 Posted September 17, 2003 i thought you use delegates to create events Quote
AlexCode Posted September 17, 2003 Posted September 17, 2003 Just to add some info to the AndreRyan reply you can pass arguments in the custom events too... like: Public Event DataArrived(ByVal sender As Object, ByVal e As EventArgs) If you want to pass something special with the event (some valiables states or anything else you can enherit from the class EventArgs and make your own Arguments... quite easy task... Enjoy ! Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.