|
Well I have 4 different forms and a login form for the user and the admin. If the user logs on I want to be able to restrict them from accessing certain forms.
|
|
|
|
|
So what's wrong with checking the users access level when the user selects whatever option needed to create the new form? You'll need to check this for EVERY way to create the new forms. Or, you can even enable/disable certain controls on the form depending on the access level.
Security needs to be designed in before you even write the 1st line of code. You can't just slap this on as an after-thought and expect it to work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i am trying to get started with some api calls in VB6.
i have found the declarations for the API calls, but don't know how to get the windows handle so that i can get the HDC to get everything else.
thank you
|
|
|
|
|
You can get windows hWnd's from the FindWindowEx API. The Spy++ utility tool installed with Visual Studio is indispensible for determining search criteria to find a specific window, because to find a child window handle you must first find it's parent window, and often the window you are looking for may be nested under several or more "generations" of parent handles.
Robert
|
|
|
|
|
You can use rwestgraham's method to get the window handle, or you can do it the easy way and just use the value that's in the form's hWnd property.
Dim windowHandle As Long
windowHandle = Form1.hWnd
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for the easy way to get the handle to the app form.
what I'm trying to do in my app is dynamically size the label.width of a prompt and the text.left of the data next to it, that the user edits. i believe i need to get the TextMetrics for the selected font to calculate the widths and left positions. There's probably an easier way to do this too.
+----------+--------+
|first label: |first text|
+----------+--------+
+-------------+-----------+
|second label: |second text|
+-------------+-----------+
|
|
|
|
|
The GetTextExtentPoint32 API will return the length of a string in points, which can then be converted to pixels or other units to size a Textbox control to fit the text. You can easily size a Label control to fit it's text by simply setting the AutoSize property to True.
Robert
|
|
|
|
|
I also want to run my program from a cd, any suggestions?
rives
|
|
|
|
|
I'm trying to add a tab control to my form, and I did that, now i need to code it, does anyone have any sample code for that form.
rives
|
|
|
|
|
Hi!
What do you mean by code it?Add TabPages?
Create a TabPage objects, assign some text to the Text property and then do TabControl.Controls.Add(myTabPage) and the tabControl will have a new tabPage.And so on...
dim myTabPage as New TabPAge
myTabPage.Text = "Tab1"
(...)
myTabControl.Controls.Add(myTabPage)
Never say never
|
|
|
|
|
|
looks very critical problem...
|
|
|
|
|
or very critical boy
moreover it's his first post !!!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Does anyone know how i can calculate the average of all the integers in a column in a SQL table using vb code?
|
|
|
|
|
this sql statement will do the trick...
SELECT AVG(int_column) FROM your_table
// TODO: Write code.
|
|
|
|
|
This is exactly what i needed but i have a few questions.
does the "int" in int_column have to be there?
How do i get this value through code and save it to a variable?
How do i display this average value in a textbox or messagebox?
|
|
|
|
|
No, int_column was what I used to mean your Integer Column.
And for the rest of it...
<br />
Imports System.Data.SQLClient<br />
...<br />
Dim conn as SQLConnection<br />
Dim cmd as SQLCommand<br />
Dim str as String<br />
<br />
conn = New SQLConnection("server=localhost;uid=sa;pwd=;database=yourdb")<br />
conn.Open()<br />
cmd = new SQLCommand("SELECT AVG(int_column) FROM table")<br />
str = cmd.ExecuteScalar().ToString()<br />
<br />
MessageBox.Show(str)<br />
I don't know if that is exactly right, but it's a good place to start from. Here is some light reading to fill in the blanks.[^]
// TODO: Write code.
|
|
|
|
|
That is exactly what i needed.
Thank you
|
|
|
|
|
Does anyone have any experience with msgboxresult
I have a yes or no message box that comes up when the user
clicks the Delete All button. When they click yes i want to run
my DeletAll() sub but if they click no i do not want anything to happen.
Here is my code but when i run it, it will delete all no matter which button
i push.
msgbox("Are you sure you want to delete all records? ", msgboxstyle.YesNo, "Delete All Records?")
If msgboxresult.yes then
DeleteAll()
Else
Exit Sub
End If
|
|
|
|
|
Yeah here you go:
<br />
If msgbox("Are you sure you want to delete all records? ", msgboxstyle.YesNo, "Delete All Records?") = msgboxresult.yes then<br />
DeleteAll()<br />
Else<br />
Exit Sub<br />
End If <br />
OR
<br />
Dim msgRes as msgboxresult<br />
msgRes = msgbox("Are you sure you want to delete all records? ", msgboxstyle.YesNo, "Delete All Records?")<br />
<br />
If msgRes = msgboxresult.yes then<br />
DeleteAll()<br />
Else<br />
Exit Sub<br />
End If <br />
// TODO: Write code.
|
|
|
|
|
Thank you, i didnt think of doing it that way.
I actually ended up doing it like this
select case msg(...............)
case msgboxresult.yes
DeleteAll()
case msboxresult.no
end case
|
|
|
|
|
I had an application handed to me that get the 'privilege' of fixing. This is a vb.net web app that is leaking memory like none other ( ok ok... it's leaking references to objects... fact is it's using up 2gig of memory when it should be using 40Meg).
I'm having a heck of a time locating the source of the memory leak. It is a medium sized application ( about 30,000 lines of code ). Any Ideas on where I should start looking? I see the following lines of code repeated many times over... anything in here look like a memory leak to you?
<br />
Catch ta As Threading.ThreadAbortException<br />
Catch ex As Exception<br />
Throw New ApplicationException("Error Retrieving Area Types", ex)<br />
<br />
Finally<br />
If Not dbConnection Is Nothing Then<br />
If dbConnection.State = ConnectionState.Open Then _<br />
dbConnection.Close()<br />
dbConnection.Dispose()<br />
dbConnection = Nothing<br />
End If<br />
<br />
End Try<br />
// TODO: Write code.
|
|
|
|
|
Well it sounds good. If you could explain about your application then it would be much better for us to guide. other wise we can say just start from there....
Do one thing ... at the end of every event ,Procedure , Function write
GC.Collect()
this will collect the garbage which your system is not releasing. Secondly if you are using datasets and datatables then close them and set them to nothing after using them and right after that write GC.collect line to collect the garbage. I am sure this will help you out and will brought you back to the orignal memory.
|
|
|
|
|
I forgot to include some more info...
I have tried using GC.Collect()... it does not seem to release the memory... it just promotes most of it to Gen2 ( Gen2 will show around 500MB after 2 hours of 14 users using the app ). So the references are still alive somewhere. I'll try closing the datasets.
Datasets are used extensively throughout this application. The application is an asp.net interface to a large database.
The biggest memory hog appears to be the forms for data entry. The forms have up to 70 different entry fields with some of them being drop down lists that are populated by the database. The drop down lists are cached in a hash table.
// TODO: Write code.
|
|
|
|
|
well from your point I am quite afraid that you are might be using wrong queries. like to fetch ID from Table you are using select * from Table... and then you are puting them in a session to save them from fetching again. if it is true then dont do this. try to destroy maximum memory at server side MANUALLY ... instead of waiting
like
DataTable or Dataset.Dispose()
GC.GetTotalMemory(True)
GC.WaitForPendingFinalizers()
GC.Collect
means destory every thing... second thing is how many session variables you have and how many of them are datatables and datasets etc..... like asking for the variables which can consume unlimited space... Same with the application level variable....
hope this will help and let me know if nothing goes fine....
cheers......
|
|
|
|