|
Hi,
You could try and adapt the way your ErrLog.txt file gets written, or use a streamreader to read through the file, but you could also consider one of the following two alternatives:
1. Forget about the DataGridView; ideally nobody will ever have to look at the information in the file, or better, nothing will ever get written to it. In other words, you will need very little access to this information, so why put an inordinate amount of time in developing this idea, when you can put the data in a ListBox, with minimal effort, or even just open the text file by hand. Ofcourse this depends on the average amount of errors thrown.
2. Forget about ErrLog.txt;
Psycho-*Coder*-Extreme wrote: I'm fairly certain I'll need to make it a comma delimited file
Whether this or some other solution, in the end you will have to change the way your app writes the error data to the file. So consider the easiest way to fill a datagrid, which I would say is a dataset. The easiest way to fill a dataset from a file, is with the use of xml. I.e. your app runs > an error is thrown > an entry is made in DS_ErrorLog1 > DS_ErrorLog1 is the data source for the datagrid > push the button, et voila, the datagrid is shown. (and if you want > when the app is closed you call DS_ErrorLog1.WriteXml("ErrorLog.xml") , and when the app is launched you call
DS_ErrorLog1.ReadXml("ErrorLog.xml")<br />
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan,
Thanks for the ideas. When first created the error log I didn't have the idea of a reader for it so I didn't bother with a comma delimited file, now I know that part I'm going to have to change. Some of the errors are unavoidable, we are dealing with an off-site 3rd party that my application is communicating with, and given a process, one of 55+ errors can be returned, some of which can cause the application to "not act so nicely". I feel I have done an adequate job of exception handling, but I don't feel that for the other developer working on this with me (thus the reason behind the error log to begin with.
I am creating and implementing this so when an error does occur (60% of which is from teh 3rd party host), Id like to be able to go to the users desk, open the log viewer and find the error, even sort by date. I still like the writing it to the text file, but I can always convert it to a DataSet then populate the grid from there, I was just hoping for possibly a cleaner solution.
|
|
|
|
|
Hi,
I see your problem. Once again I recommend xml over delimited text, simply because the basic principle is pretty much the same, but getting data from an xml file into a datagrid is more straightforward.
Otherwise feel free to use this code in your error handling:
Public Function SendEmail(ByVal oFrom As String, ByVal oTo As String, ByVal oSubject As String, ByVal oText As String, Optional ByVal oCC As String = "", Optional ByVal oBCC As String = "", Optional ByVal oPri As Integer = 0)<br />
Try<br />
Dim mailmsg As New System.Web.Mail.MailMessage<br />
With mailmsg<br />
.From = oFrom<br />
.To = "your.colleague.coder@yourcompanyname.com"<br />
.Cc = oCC<br />
.Bcc = oBCC<br />
.Subject = oSubject<br />
.Body = "You suck!!!"<br />
.Priority = oPri<br />
End With<br />
System.Web.Mail.SmtpMail.SmtpServer = "smtp_server_name"<br />
System.Web.Mail.SmtpMail.Send(mailmsg)<br />
Catch Ex As Exception<br />
MsgBox(Ex.Message)<br />
End Try<br />
End Function
I Hope you manage to solve the problem, good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I would love nothing more than to do this, but I got a feeling it would catch the eyre of my superiors
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
Hello,
I have a datagridview which I fill with data using a bindingsource. I am using typed datasets and have set the properties of the bindingsource to the typed dataset and data table using the designer. I can then use the table adapter to fill the dataset and assign the data source of the datagridview to the bindingsource. This works fine. My code shows below.
However, I am not sure about the code that will allow me to edit the datagridview and then save all the changes. The user will enter or edit some of the values in the grid. Once they have finished they will click a button to save all changes to the database.
Does anyone have any code samples of this?
Many thanks for any advice,
'Fill the software part<br />
Private Sub FillSoftware()<br />
Try<br />
Me.TA_Software_dsComponent_Equipment.Fill(Me.DsAddComponetAndEquipment.Software)<br />
Me.dgvSoftware.DataSource = Me.bsSoftware<br />
<br />
Me.HideSoftwareColumns()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try<br />
End Sub
|
|
|
|
|
A TableAdapter? You should just be able to call the Update method on the TableAdapter to get the changes written back to the database.
|
|
|
|
|
I need to send a file from a visual basic to a device through a RF modem using a rf232 connection. Where would I look to find how to open the Com port?
|
|
|
|
|
|
I am attempting to populate a ComboBox on a Windows Form. Under the properties I have set the DataSource, DisplayMember and the ValueMember. This does in fact display each row of my data. What I would like to change are the following two things:
1 - I do not want a default value, when I run the form it displays the first row of data. I would like this to be blank.
2 - I think it would be better to do this by code instead of through the IDE. Currently, I have a added an OleDbConnection, an OledbDataAdapter and a DataSet through the IDE (they appear at the bottom of the IDE window). They are configured through the properties for each but again, I think it would be a better practice to do this through actual code. Can someone point me in the direction of a good tutorial for doing this. I am using an Access2003 database.
Thanks,
Dan
|
|
|
|
|
If you data bind a control, it will select a value, it can't be blank. You'd have to add a blank item to the list.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This is how you can do it:
'Populate ComboBox.
ComboBox1.DataSource = myDS.Tables(0)
ComboBox1.ValueMember = "ColumnName"
ComboBox1.DisplayMember = "ColumnName"
'Add a blank row.
DR = myDS.Tables(0).NewRow
DR(1) = ""
myDS.Tables(0).Rows.Add(DR)
'Initially show blank row in ComboBox.
ComboBox1.SelectedIndex = ComboBox1.FindStringExact("")
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
Thanks for above code. It works just the way I would like it to.
Dan
|
|
|
|
|
Hello everyone, I am currently running VB.Net 2005 (to and Access 2003 MDB) and setting up a Crystal Report using the versions of Crystal that came with the program.
In my program I have a field where the user can put in a person’s height in inches. But when I run my report I need to show that value as ‘X ft. X inches’.
I can’t find a built in function in Crystal that will do this (like the built in function to calculate someone’s age). Does anyone know if there is one or if there is another way to do this with a formula field or something?
Thanks for any help that you can give me with this.
|
|
|
|
|
Last time I checked, there were 12 inches in a foot. Divide inches by 12, drop the remainder. There's your feet. Modulous the same number of inches by 12 and you've got the remaining number of inches.
|
|
|
|
|
Hey Dave, thanks for the reply.
(You are right, the last I checked there were 12 inches in a foot as well. AND the last I checked there are 52 weeks and 365 days in a year, but Crystal still has a function for finding the exact age of someone based on their Date of birth to make our lives easier)
1. So there are no functions that will do this automatically? Or do you know?
2. What is Modulous?
|
|
|
|
|
CCG3 wrote: What is Modulous?
Clickety[^]
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
Here's a better, more helpful link[^].
Hope that's clear now.
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
Why does something so simple have to be prewritten? Why not just create a calculated field and get what you want in 10 minutes?
|
|
|
|
|
Dave Kreskowiak wrote: Why does something so simple have to be prewritten? Why not just create a calculated field and get what you want in 10 minutes?
Well Dave, you have to understand that some of us are newbies and we are looking for help. I have never heard of a 'calculated field' nor do I know how to create one. If it is so simple can you help me set one up? Or give me a example of what one is? (you are talking about creating this in Crystal right?)
|
|
|
|
|
CCG3 wrote: I have never heard of a 'calculated field'
Allow me to quote from your original post:
Does anyone know if there is one or if there is another way to do this with a formula field or something?
|
|
|
|
|
Ok, so are you saying that a 'calculated field' is the same as a formula field?
If so, then can you show me an example of how this can be done with a formula field?
-- modified at 9:44 Friday 29th June, 2007
|
|
|
|
|
CCG3 wrote: f so, then can you show me an example of how this can be done with a formula field?
Nope. I don't have any example because I don't use Crystal Reports.
|
|
|
|
|
Hi, is it possible to make password character in windows form like in web form?
|
|
|
|
|
Obviously, you haven't noticed the PasswordChar property of the TextBox control.
|
|
|
|
|
hello frnd,
try to use "PasswordChar" property of textbox you can put any char as password char
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|