|
Microsoft create some stuff called the "Application Blocks for .NET" a while back. One of those was called "Exception Management".
They're complex, but they're free.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
I have a simple class which does all this for you.
When your program initialises, you do this:
If (Not System.Diagnostics.Debugger.IsAttached) Then<br />
ExceptionManager.Instance().AppName = "YourAppNameHere"<br />
End If
The class then pops up a dialog when an exception occurs, showing the stack-trace, error message, etc, and on closing that dialog, a new instance of the program can optionally be started.
You don't have to have the Debugger.IsAttached test, but it means that the exception handler won't pop up if you are debugging in the IDE.
Let me know if it sounds like what you need.
|
|
|
|
|
Sounds simple enough. Perhaps you might direct this to the attention of the person who posted the original query; by replying to my reply, the message went to me instead of him.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
It sounds exactly like what I need. Would it be possible for me to get a copy of it.
If so, I'd really appreciate it.
Thanks,
Wayne
|
|
|
|
|
Sorry, I know this could be stupid question but I'm not VB developer. I want to know is it possible to use CryptoAPI in VB.6 or not. All the samples in MSDN are in C , so just tell me yes or no and if you know any sample please let me know. Thanks.
Mazy
You're face to face,
With the man who sold the world - David Bowie
|
|
|
|
|
|
Yah , it helps. Thanks.
Mazy
You're face to face,
With the man who sold the world - David Bowie
|
|
|
|
|
Hallo,
My current program consisted out of 80 forms, and then about 15 classes with shared functions. Recently I put each of these classes in different dll's, so that I only have to update / compile single files.
To control versioning i have to make these class's strong named assemblies, but to create these there is more errors, even a "MsgBox" get the error Name 'MsgBox' is not declared, Importing System.Windows.Forms.MessengeBox stop this problem but just created other problemes. So going for the Storng Named Assembly in the GAC will not do the trick.
My question now is, how can I control the dll's, my next idea was to when the program start to check a dir on the network and compare this system dll's with those stored on the network, if the network version is newer then replace the local system file. Problem still stands I can't update the dll's while the program is running.
The second thing, automatic updating the version number each time the assembly is rebuild, VB.Net doesn't do it every time the assembly is rebuild, can one set this somewhere.
Thanks
Johan
|
|
|
|
|
I want to send mail from "VB form" using default mail client available in the system.
I have done it using Microsoft outlook.
But I want to give flexibility to the user to use the mail client available on his/her machine? How we can do that?
Kiran(grover)Adlakha
|
|
|
|
|
One of two ways: add a reference to the Outlook libraries to your project or use the SmtpMail class.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
How can I map network drives in vb.net?I tried using WNetConnectionDialog() but it didnt work out.Plzzz suggest a method.
|
|
|
|
|
Here Try this.
This is the code to add the network Drive
Dim WshNetwork as Object<br />
WshNetwork = CreateObject("WScript.Network")<br />
WshNetwork.MapNetworkDrive("L:", "\\Server\Resource")
Of course you can have the letter be whatever and just fill in your resource
Here is the Code to remove it after the object is created
WshNetwork.RemoveNetworkDrive("L:")
And of course it the letter that you specified earlier.
I hope this helps
|
|
|
|
|
Hey people, what's up?
Well, I am quite new to this whole VB/VBNET thing and I love it already. I am also stuck with a little problem. I am trying to design a program that creates a ten digit alphanumeric code. I have no idea how to approach that goal. Can anyone help me?
I appreciate any help!!!
|
|
|
|
|
i will give you an example of how to generate a random number. then, an example of how to return a character, using its Ascii value (ex, A = 65). then finally a way to return a random character.
** NOTE: for these examples, i am using a VB.net Console Application. **
GENERATE RANDOM NUMBER:
Module Module1
Sub Main()
'declare variable to store your random number
Dim myNumber As Integer
'initialize a method to generate random numbers
Randomize()
'create a random number and store it in our variable
myNumber = (50 * Rnd()) + 1
'the statement (50 * Rnd()) + 1) will generate a random number from 1-50.
'If you excluded the " + 1" part, it would generate a number from 0-49.
'write our variable to the screen
Console.WriteLine(myNumber)
'pause for display, by waiting untill the user presses -ENTER-
Console.ReadLine()
End Sub
End Module
RETURN A CHARACTER USING ASCII VALUES:
console.writeline(Chr(65))
'displays "A" on the screen. if you dont want to print it and only return its value, just use Chr(65).
GENERATE RANDOM CHARACTERS:
after reviewing the top 2 methods, you should be able to know how to do this. here is an example though:
Console.WriteLine(Chr((127 * Rnd()) + 1))
'this will display a random Ascii character. again, if you just want to return it and not print it, just use the Chr(...).
ASCII: for more info about Ascii and a chart of characters and their corresponding ASCII values, visit asciitable.com[^]. The "Dec" column is the "Chr"'s ASCII value.
------------------------
Jordan.
III
|
|
|
|
|
Hey Jordan,
Thank you very much for the information. Although I have not tried it yet, it looks very helpfull. Again, thank you!!!
Al Ahmad
|
|
|
|
|
yup, no prob.
------------------------
Jordan.
III
|
|
|
|
|
I'm reading xml from SQL server with VB.net using an XSD schema file. I have the code working fine, but I'd now like to change the code from reading a file on disk to reading the schema from the file as an embedded resource. Here's my code, what do I need to change??
<br />
Dim conString As String = "MyConnectionString"<br />
Dim strm As Stream<br />
Dim strmReader As StreamReader<br />
Dim cmd As New SqlXmlCommand(conString)<br />
Dim xmlDoc As New XmlDocument<br />
Dim strXML As String<br />
<br />
With cmd<br />
.CommandText = "MyXPath"<br />
.CommandType = SqlXmlCommandType.XPath<br />
.SchemaPath = "C:\MySchemaFile.xsd" '**I want this to be embedded!!**<br />
strm = .ExecuteStream<br />
End With<br />
<br />
strmReader = New StreamReader(strm)<br />
strXML = strmReader.ReadToEnd<br />
xmlDoc.LoadXml(strXML)<br />
Like I said, the above code works fine, but I don't want a physical file location.
Thanks!!!
-Michael
|
|
|
|
|
Hi Michael. There are several articles on CodeProject that could help you. Do an article search on "embedded resource". Here's a link to one article[^] that may be useful.
|
|
|
|
|
How can I get the changes made by a user to a datagrid's content to reflect in the "datasourced" dataset so that the database can be updated accordingly ?
This is for a desktop program not asp.
The dataset is filled by an SqlDataAdapter
|
|
|
|
|
Isn't your DataGrid bound to the underlying DataSet? Shouldn't you be able to update the data source using the data adapter's update method?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Any changes to the dataset reflects on the grid, but not visa versa. Either I am missing something, because it seems some intervention is needed.
On the CurrentCellChanged event I have to add the following line (assuming the datasource is a dataset of course)
Static PrevCell As DataGridCell
Dim dsSender as Dataset
dsSender.Tables(0).Rows(PrevCell.RowNumber).Item(PrevCell.ColumnNumber) = PrevCellData
'becomes prev cell on next itteration
PrevCell = sender.CurrentCell
Only then does
ds.AcceptChanges and da.update(ds) work.
I am not even talking about adding new records yet.
Any suggestions to simplify the process would be appreciated.
|
|
|
|
|
Danny,
I apologize for my "shoot-from-the-hip" response to your question. It really isn't that simple, is it?
Although I don't spend a whole bunch of time with Windows Forms, what I think has to be done with a DataGrid is to use BindingContext, create a new event handler, such as OnPositionChanged, and bind that handler to the PositionChanged event of the BindingContext. Then, in the event handler, you can decide whether or not you want to update the whole data set for a row change. Unfortunately, the examples I find of this method are really pretty trivial, though I haven't tried searching for information about them here on CodeProject yet.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Apology accepted. Thing is, it IS as simple as your hip shot. The Grid DOES affect the datasource and visa versa.
The dataset.acceptchanges statement just before the dataAdapter.updatedataset part appears to be the stoolsample in the applepie. It changes all rowstates from deleted, added to unchanged. Which in turn must be telling the adapter that nothing happened.
Took out ds.acceptchanges and problem solved.
|
|
|
|
|
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
hi der,
If possible could someone please solve this problem of mine. I am a beginner and want to get my results in Excel format but the output which i need has to be formatted and i am not able to get that kinda format. Have already developed the application with backend in Access and need to get the data frm Access and display it in Excel. Have already incorp. Crystal reports and have put the export tab on it. but what i need is an Excel format. If anybody can do it please mail me i can send u the Excel file in the format which i want.
|
|
|
|
|