473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

accessing data from a class event in a form

I have a multiproject solution; one of the projects is a group of classes
doing data massage and insertions. One of the other projects is a UI that
kicks off the process in certain situations. I'd my UI to be able to read
properties or events or whatever it takes so the UI can display messages
about what's happening in the data project. However I can't find any
documentation on how to do this. Can someone please point me in the right
direction? TIA.
--
glen
Nov 9 '06 #1
4 1031
It depends on where you instantiate instances of your classes. If it's in
the UI, then you can put events in your classes and handle them in your UI
thread. There are many ways to do this.
--
Dennis in Houston
"glen" wrote:
I have a multiproject solution; one of the projects is a group of classes
doing data massage and insertions. One of the other projects is a UI that
kicks off the process in certain situations. I'd my UI to be able to read
properties or events or whatever it takes so the UI can display messages
about what's happening in the data project. However I can't find any
documentation on how to do this. Can someone please point me in the right
direction? TIA.
--
glen
Nov 9 '06 #2
I thought it might be something along these lines. Sounds like your saying I
need event handlers in the UI code to capture the output of class events. Can
you point me at some good examples? TIA.
--
glen
"Dennis" wrote:
It depends on where you instantiate instances of your classes. If it's in
the UI, then you can put events in your classes and handle them in your UI
thread. There are many ways to do this.
--
Dennis in Houston
"glen" wrote:
I have a multiproject solution; one of the projects is a group of classes
doing data massage and insertions. One of the other projects is a UI that
kicks off the process in certain situations. I'd my UI to be able to read
properties or events or whatever it takes so the UI can display messages
about what's happening in the data project. However I can't find any
documentation on how to do this. Can someone please point me in the right
direction? TIA.
--
glen
Nov 10 '06 #3
Never mind I figured it out. For the benefit of others here is my code.

In the declarations area of one of my classes I inserted the following:
Public Event UIData(ByVal text As String)

In one of the class functions do some processing and want to send a message
to the UI so inserted the following:
RaiseEvent UIData("Successful File Read. Record count of " & CStr(rcount) &
". Database Insert commencing....")

Next, in the load event of the form I did the following:
AddHandler processor.UIData, AddressOf DataHandler - to watch for the output
of a raised event in my class.

Finally I added a sub() to insert the data to a list box:
Public Sub DataHandler(ByVal data As String)
lstEvents.Items.Add(data)
End Sub
--
glen
"Dennis" wrote:
It depends on where you instantiate instances of your classes. If it's in
the UI, then you can put events in your classes and handle them in your UI
thread. There are many ways to do this.
--
Dennis in Houston
"glen" wrote:
I have a multiproject solution; one of the projects is a group of classes
doing data massage and insertions. One of the other projects is a UI that
kicks off the process in certain situations. I'd my UI to be able to read
properties or events or whatever it takes so the UI can display messages
about what's happening in the data project. However I can't find any
documentation on how to do this. Can someone please point me in the right
direction? TIA.
--
glen
Nov 10 '06 #4
That's it! You can also setup to access procedures and properties of the
form class in the classes setting a property in the Class to the Form or pass
the Form as a variable in the New procedure of the Class. Then in the Class,
you can call procedures/properties in the Form class.

Anyway, sounds like you are off and running until the next problem arises.
Good Luck.
--
Dennis in Houston
"glen" wrote:
Never mind I figured it out. For the benefit of others here is my code.

In the declarations area of one of my classes I inserted the following:
Public Event UIData(ByVal text As String)

In one of the class functions do some processing and want to send a message
to the UI so inserted the following:
RaiseEvent UIData("Successful File Read. Record count of " & CStr(rcount) &
". Database Insert commencing....")

Next, in the load event of the form I did the following:
AddHandler processor.UIData, AddressOf DataHandler - to watch for the output
of a raised event in my class.

Finally I added a sub() to insert the data to a list box:
Public Sub DataHandler(ByVal data As String)
lstEvents.Items.Add(data)
End Sub
--
glen
"Dennis" wrote:
It depends on where you instantiate instances of your classes. If it's in
the UI, then you can put events in your classes and handle them in your UI
thread. There are many ways to do this.
--
Dennis in Houston
"glen" wrote:
I have a multiproject solution; one of the projects is a group of classes
doing data massage and insertions. One of the other projects is a UI that
kicks off the process in certain situations. I'd my UI to be able to read
properties or events or whatever it takes so the UI can display messages
about what's happening in the data project. However I can't find any
documentation on how to do this. Can someone please point me in the right
direction? TIA.
--
glen
Nov 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
4
by: Sean Connery | last post by:
I have a Microsoft UI Process Application Block that is controlling child forms in an MDI parent container. The views node in the app.config file has been set to stayOpen=false. Because there...
3
by: Iain | last post by:
Hi I have page (testCal.aspx) that contains a usercontrol (custCalendar.ascx) - see below signature for code. The UC contains a linkbutton which which when clicked, posts back and displays a...
8
by: Mike Caputo | last post by:
In VB.NET, need to be able to access certain properties on my main form from other forms. These are properties that may be changed by the user, so I have to be able to get to them throughout the...
3
by: DotNetNewbie | last post by:
I am reading the book Teach Yourself Microsoft Visual Basic .Net 2003 in 21 Days. I am having trouble getting one of the exercises to work at the end of day 4. Exercises: 1. Create a new...
3
by: Ithaqua | last post by:
I have a form created in the IDE and I want to access a combo bix control on this from. How do I do it? -- Cheers Ithaqua
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
2
by: Jon Slaughter | last post by:
What concepts do I have to know to access data between two threads safely? Right now I'm using a delegate method and Invoke to call a function in the other thread that handles the data. This...
4
by: nottarealaddress | last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work after officially stopping new development in VB6 about a month ago). I'm working with a simple sql 2005 table of 50 entries, one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.