|
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
|
|
|
|
|
If you are determining the RecordNo on your end and not letting the database determine this then you will run into problems. I would let the database use an AutoNumber column for the RecordNo column OR in your Insert grab the highest RecordNo then add 1 to it and insert that, whatever you think would work best.
Cleako
|
|
|
|
|
Hi,
Recordno is auto.
thanks, Joseph
programmer
|
|
|
|
|
How are you inserting the new record then? If you are calling a SP or even using straight SQL it should create a new Recordno and should not violate the Primary Key constraint.
Cleako
|
|
|
|
|
Anyone got experience with ByteFX in Visual Basic 6?
I had it working once long time ago.
Don't remember how i did that though..
Could someone please help me with this?
Kind Regards
Sven (djnevs)
|
|
|
|
|
I’ve got a need to “add” an entire column of times (2 hrs, 30 min, etc.) and curious as to what the best starting point is. I want to calculate the total time of a column by means of a Button Click. I will need to do this per three different criteria for testing time.
I appreciate the advice.
|
|
|
|
|
You could just store the data in the column as an numeric value. For example, you can format the current time like this:
CInt(Now.ToString("hhmm"))
and now you have an integer value. There are also many other options for formating the time (You will want to research that, because I can't remember if hh or HH is military time and that will make a difference when you are converting the integer back into a DateTime object)
But I don't understand what you mean by calculating the total time of a column. You must mean that you want to get the time spans between the times right? Remember that there is a difference between a TimeSpan and a DateTime object.
Please provide more information if you need further help.
I hope this helps.
|
|
|
|
|
I knew what "I" was talking about and wanted; I didn't convey the actuals. Sorry.
I'm thinking time as in duration or test period. I apologize for the confusion on my part.
I have a column in an Access Db that states how long a test is running, 2 hours or 30 minutes and so on for 3 three different tests. Test A,B,C are in column 1 with the test duration in column 6.
Example:
Test 1
TestA 2.5 Hrs
TestA 30 Min
Test 2
TestB 20 Min
TestB 1.5 Hrs
Test 3
TestC 1 Hr
TestC 45 min
I need a way to calculate the entire testing times for Test 1, Test 2 and Test 3 individually. I am planning on having a ComboBox with these Tests 1,2,3 and a Button to Calculate the times associated with each test that is driven from the Access Db, per test.
Hope that makes better sense.
|
|
|
|
|
I'm still a bit confused. What is the data in your table going to look like?
I think I would suggest to store the testing durations as an integer value of minutes. So 2.5 hours would be stored as 150. Then you can convert them to display in whatever format you want later.
So, your initial question is still escaping me. If you are asking how to get the sum of the durations for each Test...it would be like this:
SELECT testField, SUM(duration) FROM table GROUP BY testField
If you are asking how to get the individual durations for a specific test it would be like this:
SELECT durationField FROM table WHERE testField='Test1'
If this is not what you are asking for, could you please explain the situation a little better. What is the difference between Test 1,2,3 and Test A,B,C?...what will your table look like with data in it?...what is it that your program is actually supposed to accomplish?
Hope this helps.
|
|
|
|
|
Sorry if I’m not explaining this very well.
I have under TestA, several test variations that each have a certain duration allotted to them. My need is to somehow calculate the entire time or duration for all tests in Test A and so on.
Example:
Test A - #1 takes 1 hr.
Test A - #2 takes 2 hrs.
Test A - #3 takes 3 hrs.
Button Click to add the entire Test A test times would equal 6 hrs.
The differences in Test A,B,C are all different tests. The 1,2,3 are tests performed for each Test A,B,C. Does that make sense?
This app is supposed to calculate the total duration of all testing to allocate personnel and resources effectively. Doesn’t seem logical to me, but evidently there’s a need for it.
|
|
|
|
|
That's okay...It's always hard to know what information is important when asking a question. But it seems to make more sense to me now. I think this is what you are looking for:
SELECT SUM(durationField) FROM table WHERE testField='TestA'
This will return the sum of durations for TestA.
Hope this works for you!
|
|
|
|
|
I'll give that a try and post a verdict. Thanks again for helping me and working through my information. I appreciate the help.
Thanks again.
|
|
|
|
|
Hi I am creating a listview dynamically.But the list view columns are not fixed .on runtime I can change the column by mouse like excel.I want to stop it.how can I do it.
Thanks in Advance
Sandy
|
|
|
|
|
Hello I am a visual basic starting developer for VWD. I was wondering how to make my website chat service "Live", I just need one page to be updated without a user having to press a button
Seanph
|
|
|
|
|
Hello I am a visual basic starting developer for VWD. I was wondering how to make my website chat service "Live", I just need one page to be updated without a user having to press a button
Seanph
|
|
|
|