|
Well, these are not competing ideas. I would write some functions that I want to have run when I call them, right away. Other functions, I want to call when an event occurs, such as a button being pushed. Just writing code in your event handlers, makes for very messy code. Your UI classes would work this way, but they would mostly just create business objects, and call their methods, which are not going to be event driven.
For example, you may have a Person class. It may have properties to specify name, address, etc, and a method to save that person to the database. You wouldn't rewrite this code in every event handler, the class would handle it, and different event handles would call it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well I am looking at some code here that uses RaiseEvent for a few things so I Googled it and found this - http://msdn.microsoft.com/msdnmag/issues/05/06/EventHandling/[^]. Now I understand the UI dealing with events such as a button click but I never thought say -
If intCount = 500 <br />
Then RaiseEvent SaveInformation(Datatable) <br />
End If
or whatever, because I would have said -
if intCount = 500 <br />
Then SaveInformation(Datatable) <br />
End If .
Is this just a way to let another class handle what happens when this occurs?
If you look at that article it makes me feel like I dont know anything!
Cleako
|
|
|
|
|
The article says that RaiseEvent is something they kept from VB6. Which means, it's crap.
cleako wrote: Is this just a way to let another class handle what happens when this occurs?
No, delegates are how you do that. Unless RaiseEvent is a way to call a delegate in VB ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I love hearing people say VB6 is crap.
Cleako
|
|
|
|
|
*grin* Happy to oblige
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Any help/guidance with this would be much appreciated!
Im working on developing a system that ultimately generates a timetable of events, much like an timetable for a track event, allocating people to lanes etc..
I need to be able to generate an Excel spreadsheet that is populated with the data that is held within my text boxes and labels in my forms, all Strings btw.
Is there a way that i can submit an event/race to the spreadsheet, go back and submit another race that will appear underneath the race already submitted, without overwriting what is already in the spreadsheet??
I would be very grateful for help here, and have explained it as i see the nature of the problem!
Thanks
|
|
|
|
|
Try http://support.microsoft.com/kb/316934[^]
It allows you to treat MS-Excel like a database table so that you can append new records.
Alternatively, if you create an HTML file then rename it to have a ".XLS" extension then Excel will treat it like any normal spreadsheet.
|
|
|
|
|
Thanks, ill try it out!
Appreciate the help!
|
|
|
|
|
Is it possible to to retrieve connection information from a centralized DLL without having to manually change the generated code for a DataSet item added to the project? If so, will you point me in the right direction?
Thanks!
Cleako
|
|
|
|
|
Yes Absolutely , its Very Common Idea with Professionals , I would like to help you with the same. You are always welcome with your requirement.
Develop2Program & Program2Develop
|
|
|
|
|
Where can I find some information on this?
Cleako
|
|
|
|
|
You Better Read the Way DataSet and Adapter are handled From wrox Publication books And Create dll , its easy once you start and things(dll) get better with requirements of your
Develop2Program & Program2Develop
|
|
|
|
|
I am using VS2005 and can find a users name by using the System.Environment.Username code. With this, I know there should be a way to find out what group this user is a member of.
My program will process one function if the user is a member of windows group named GROUP1 and if the user using my program is a member of GROUP2 it performs a different function.
How can I easily check if a specific user using the program is a member of GROUP1?
Any help is appreciated
Lost in the vast sea of .NET
|
|
|
|
|
Unless you are specifically wanting to view that group you can just check for If My.User.IsInRole("GROUP1") Then ... End If .
Cleako
|
|
|
|
|
I am in .NET 2.0. I tried this code before posting the message and it returns false for a group that I know I belong to.
After you posted this reply, I tried the following using the domain:
Dim blntest As Boolean = My.User.IsInRole("MYDOMAIN\Programming")
If blntest = True Then
MsgBox("True")
Else
MsgBox("False")
End If
Am I missing something?
Lost in the vast sea of .NET
|
|
|
|
|
Is this for a Windows app or a Web app?
Cleako
|
|
|
|
|
It's a Windows App. I've been researching into the Isinrole syntax and this is related to roles like administrator, power user, etc.
I'm looking for code that can find a group that the network administrator sets up to organize people by.
For example, "Programmers", "PayrollUser", "AppABCUser", etc....
There should be some way to look up this info?
Lost in the vast sea of .NET
|
|
|
|
|
IsInRole works for that purpose, Ive been using it for the custom NT roles in almost every application Ive been a part of. The only thing I can think of is that the actual Windows app does not recognize you as authenticated. Try looking at the My.User.IsAuthenticated to find out if that is true or not, if that is false then all group lookups with IsInRole will be false.
Cleako
|
|
|
|
|
Your right... I'm showing false for authenticated??? I'm signed on the network. I'm not a system administrator, but as a programmer they give me higher than normal rights.
I'm not sure why I'm not considered authenticated. I published the app and installed it and received the same result... false. I thought maybe publishing it would help, but no such luck.
You've been very helpful... Any other suggestions?
Lost in the vast sea of .NET
|
|
|
|
|
Ok, I think I figured it out. Under the properties of the project, you need to set the "Enable application framework" and then set authentication to Windows.
To set "Enable application framework" the application needs to start with a form. My application starts with a class and "Enable application framework" was not set.
Is there a work around or do I need to change my app to startup with a form?
Thanks for your help and if you have additional questions please post. In my area we're getting hit by an ice storm so I'm heading home and might not reply for 18+ hours.
Thanks again for the help you gave. You pointed me in the right direction.
Lost in the vast sea of .NET
|
|
|
|
|
Thanks, the information you posted was very helpful. I have one more question since you said you use this syntax in many of your projects, you might have ran into this problem.
My network properties show me as a member of several groups. The IsInRole syntax works fine with groups that do not have a space in the name. If the group has a space the syntax is false. I'm a member of both ITS_Team and ITS Programming, but the only message box that is displayed in the logic below is the ITS_Team message box. Is there a workaround if the group has a space or is this a Microsoft enhancement?
If My.User.IsInRole("ITS Programming") Then
MsgBox("Client (" & My.User.Name & ") is a member of ITS Programming")
End If
If My.User.IsInRole("ITS_Team") Then
MsgBox("Client (" & My.User.Name & ") is a member of ITS_Team")
End If
Lost in the vast sea of .NET
|
|
|
|
|
I can only think of one application that checked a group with a space in the name and I am unsure how that worked out because I was not the primary programmer on that application. This question may require a new thread in order to find that out.
Cleako
|
|
|
|
|
Hello,
I created VB.NET application and opened it multiple times. I entered data iin one of them and entered data into other open ones as well. I got error message when i saved the other open instances of the same VB.NET application. I acted like multiple users were entering data at the same time.
What Do I need to do In order to allow multiple user be able to enter data at the same time and save it without getting any error. (just like in MS access database.
thanks, Joseph
programmer
|
|
|
|
|
I've created several apps where multiple users open the program at the same time. I'm not sure what your trying to access? Your problem might be the file your opening. I guess for anyone to answer your question, you'll need to give more details on the data your trying to open for multiple users.
Lost in the vast sea of .NET
|
|
|
|
|
Hi,
I am not trying to access anything. My question is I have 8 users and they might be opening VB.NET application at the same time to enter user data. I just want to make sure that they can do that without any problem.
To test it, I opened the application twice and entered data and saved it then I entered another data into second one and got error message saying that same primary key(recordno) cannot be used. So it didn't refresh the data in the second one when I saved the data on the first one.
I guess this can happen if the users entering data exactly at the same time.
thanks, Joseph
programmer
|
|
|
|