|
well right said !!!
but this does work with outlook 2002(XP) but not with outlook 2003 !!
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
VB.net 2005 & SQL 2005
Hi all, this is a three part question, as im to lazy to put up three different posts.
The project is an application that contains several forms, all accesses from a main form
Q1.
Once the user is logged on they arrive at the 'main menu'. what id like to try and do is dynamicaly create the options on that form dependant on what they are allowed to do ( this can be obtained via SQL query )
there is a table in the database that holds all the form names, display names and security level
What id like to do is display only those 'display names' that the user have the releven security level to, and have the onclick event . to redirect them when the select a form
I know there are some real wizz guys out there, but inststead of just throwing code, can some one give an example and explian what its doing so i can at least learn from this
Q2.
In the old vb6 there was a 'status' panel that i used to stick in info like current user , time etc. the questio is is there a similar control or would it be more prudant to create a custom control and if so how?. Is there a sim[ple way of having this on every form without having to code it every time....
Q3.
Form Settings. Currently i have a function that i call from every form that paints the form a certain colour, is there a better way to do this rather than calling a function on each forms 'load' event.
once again thanks for all you help ... this site is a great learning tool.. keep up the good work!!
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Q1,
The easiest way to do this is to put every possible option on the form and through security disable the options that available for the user. If you wanted to hide them instead, you then would just need code to bunch the options together instead of leaving gaps.
I did create an application that built the entire form via a database table. there is a lot of code to do it, but it is possible. the "bueaty" of that kind of thing is that you don't have to distribute any changes to the end user. change the database and they immediately get the change the next time they run the app.
Q2,
There is a status bar in the toolbox of dotnet. If you want to put custom code around, then make a user control that includes the status bar and then you only need to put the user control on each form and then all the code is bound in the control and all forms will use it in the same way.
Q3,
Look at inheritence. If you make a form that all your forms inherit from then you can make all your forms, have the same events (paint), variables, etc.
Example: gradient back ground for every form that inherits from it...
Public Class FormBase
Inherits System.Windows.Forms.Form
Protected Sub FormPaintEvent(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
CType(sender, System.Windows.Forms.Form).BackColor = Nothing
Dim formGraphics As System.Drawing.Graphics = e.Graphics
Dim gradientBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New System.Drawing.Point(0, 0), _
New System.Drawing.Point(sender.Width, 0), _
Color.FromArgb(221, 236, 254), _
Color.FromArgb(129, 169, 226))
formGraphics.FillRectangle(gradientBrush, sender.ClientRectangle)
End Sub
End Class
Public Class MainMenu
Inherits FormBase
end Class
|
|
|
|
|
Hi,
When VB.NET application is loading i need to close all the opened application like Notepad, Folder, Word, Winamp etc.,
Can any one give me the code to close all the apllication using VB.NET
Regards,
Senthil V.
|
|
|
|
|
i don't think that this methode is the best one. U can call on the user, that their programms should be closed, but when u kill all running processes, u may kill important data. and if u want this, u're aspiration doseen't go for the user but against the user..
|
|
|
|
|
ok thanks for advice. I am creating the Setup in VB.NET there in User's Startup Folder im setting to run my application. So that the user can able to open any application in the sytem. But what the problem when im loading the machine it take few minutes to load the project. Give me u'r suggestion to make the project load quick when Operating System loaded.
|
|
|
|
|
There really isn't much you can do. If the O/S is still starting up, which is entirely possible even though the user has a desktop showing, you have to wait for the O/S to completely start all of its services adn the same time you're waiting for it to load and start the .NET CLR with your application. You can get some benefit from NGen when you install your application on these machines, but the benefit will be small.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
Where do I find Sub New of a form in VS2005. Since the 'Windows Generated Code' is no longer visible.
Richard
|
|
|
|
|
Yes it is, it's in a seperate class. But, I think VB.NET (hideously) generates it for you magically. I think you just need to add it manually and it will use the one you provide, but I could be wrong.
|
|
|
|
|
no it hasn't this procedure cause it dosen't need it, cause
1. the class is marked as "Partial" and not as "Public"
2. the class-procedure is called mostly from the new procedure from it's owner-class..
|
|
|
|
|
All you have to do is type Private Sub New() , and hit Enter in your code file and you'll get a new contructor pasted in for you.
The Designed generated code IS visible if you go to the Solution Explorerand click on the icon "Show All Files...". You'll get a little "plus" next to each "file". Click the plus next your form and you'll see your forms Designer generated code file and the resource file. Modifying the Designer code is NOT recommended, unless you know precisely why your doing it and the the concequences are. You can easily end up getting your code in this file rewritten for you, or removed entirely, if you don't know what you're doing.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks so much!!! Appreciated
|
|
|
|
|
Hi ALl
I am trying to convert some code from C++ to VB.NET 2005.
The data type in C++ is an "index", in Pascal it is a "record".
What is it in VB.NET?
Regards
Instamatix
|
|
|
|
|
There is NO 'index' datatype in C++.
|
|
|
|
|
Hi Christian
Thanks for that.
No wonder I was having so much trouble trying to find it.
I will have to search through the rest of the code.
It must have been setup as a user defined data type somewhere.
Regards
Instamatix
|
|
|
|
|
Hi
I want to email someone my app, and have created a standard Setup.exe from VS2005. I also included that the setup check the Framwork (Prereqisites) and includes Dotnetfx.exe (Which is 22MB). I want to include this so since I'm not sure they wil be able to update to Dot Net Framework 2 from the web. Is there a way of splitting the installation files into smaller sets of files so that I can mail them (*.cab files??)
Cheers
Richard
|
|
|
|
|
You can put all your files into a ZIP file. Then Google for "file splitter[^]" and you'll find a bunch of utilities to split the file into any size chunks you want. You'll have to send both the splitter utility, so the client can put the file back together!, and the individual file segments.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave - I take it then that there is no way to create a set of install files from VS2005 (i.e. like in the old days when applications were installed from a set of stiffies (such fun...)
|
|
|
|
|
There's still a Setup and Deployment project, but only if your using the Professional version or above.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
1) How does a try catch block function? Could you relate it in any way to the following:
If (exception occurs while doing something) then
Goto Catch
else
Contine executing
Endif
2) What is good practice with respect to the amount of code inside a Try .. Catch Block. Is it bad to have a lot of code (why?) and is is bad to call another procedure from withing a Try Catch Block
Cheers
Richard
|
|
|
|
|
Hi dear
I think u r trying to catch errors in VB inside some procedure
If it is so then use following code
Option Explicit<br />
Private Sub Form_Load()<br />
On Error GoTo catch<br />
Dim x As Integer<br />
x = "abc"<br />
Exit Sub<br />
catch:<br />
MsgBox "Caught U! Integer cant take String value"<br />
End Sub
If it isnt so ignore the reply
Bye
pitchu
|
|
|
|
|
RichardBerry wrote: 1) How does a try catch block function? Could you relate it in any way to the following:
If (exception occurs while doing something) then
Goto Catch
else
Contine executing
Endif
Well, have a you look at a Try...Catch with multiple catches and a Finaly block:
Try
... do something that might fail
Catch IOException ex
... handle the specific exception
Catch Exception ex
... handle all other .NET exceptions
Catch
... handle any other exception
Finally
... always runs
End Try
If any exception is raised in the Try block, execution immediately goes to the first Catch block where the type of the exception matches. An IOException would be handled by the Catch IOException block, but an ArgumentNullException would be handled by the Catch Exception block (as ArgumentNullException inherits from Exception ). If you are calling an external library it might throw non-.NET exceptions, they would go to the Catch block.
The Finally block is used to make sure that anything used in the Try block is closed and disposed properly. The Finally block always runs, regardless if there was an exception or not.
RichardBerry wrote: 2) What is good practice with respect to the amount of code inside a Try .. Catch Block. Is it bad to have a lot of code (why?) and is is bad to call another procedure from withing a Try Catch Block
There are two uses for Try...Catch blocks; wide and narrow. A wide block can be used to handle any exceptions from an entire application, or from a section of an application. A narrow block should be used to handle the specific exceptions that you anticipate might occur, and they should surround as little code as possible.
You can't write code to specifically handle any exception that possibly can occur, so use narrow blocks to catch the ones that you anticipate, and wide block to catch anything unexpected.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hi All
Please healp me
I want to creat a automatic or in button click new folder at run time
i have using VB 6.0
Thank you!!!!!!!!
|
|
|
|
|
Hi
Suppose u wanna create folder namely wasim in c:\ directory paster this code in click event
Private Sub Command1_Click()<br />
MkDir ("c:\wasim")<br />
End Sub
Hope answer to the question
bye
pitchu
|
|
|
|