If you're using C# 2005 you can use the [OptionalFieldAttribute] on new class variables, and when you deserialize the class, the vars that have the above tag wont be required and therefore wont throw an exception. If you're using C# 2003, you can look into manually controlling the serialization process. BTW: M$ is giving away C#, VB, and C++ express for free until Nov. 2006. If you get them before then, you will never have to pay for them. You can download CD images of each.
Daniel1324
Posts
-
legacy software -
.net going away?Why dont you edit my post then. I dont like being called gullible either. I didnt say I believed him, I just asked a question here.
-
.net going away?Piss off dickhead.It was just a comment in a passing conversation.
-
.net going away?Actually, he works for a company that uses java. Good call!
-
.net going away?Somebody was telling me that Steve Ballmer(sp?) said that the .net platform wasnt going the way that MS wanted it to go and that it wont be around for much longer. Anybody else heard anything about this?
-
Deserialize ErrorThat still wont work. According to MSDN, a serialized stream will NOT deserialize in any program except the one that serialized it. Maybe of your new program has the same assembly name and such it may work. I searched for days for this answer until I came scross that on MSDN.
-
Using ArrayListI think the question was is there anything wrong with all of the casting. I also employ the arraylist for the same purpose, so I'd like to hear from the C# gurus too.
-
Email in C# 2005 (.net 2.0)private void SendBill() { SmtpClient client = new SmtpClient("my.mailserver.net"); MailAddress toAddr = new MailAddress("anybody@hotmail.com"); MailAddress fromAddr = new MailAddress("test@mailserver.net"); MailMessage message = new MailMessage(fromAddr, toAddr); message.Subject = "Test Mail"; message.Body = "This is a test."; client.Send(message); }
This is the code. I changed the server and addresses to post here. -
Email in C# 2005 (.net 2.0)Guffa wrote: From what you descibe of your problem, it sounds like mail is not sent until the object is collected by the garbage collector. Are you closing and disposing the objects you use properly? I'll look at that... thanks! I'm still new at this!
-
Email in C# 2005 (.net 2.0)The System.Web class has been deprecated in .net 2.0... So the email code I've been using no longer works. After some tinkering, I got the System.Net class to send the email, however... It wont actually send the mail until I exit the program. Whats the deal with that? The function finishes with no errors. I can wait and nothing happens. Then the moment I close the program, the email leaves my machine. I know this because Norton scans outgoing emails. Anybody?
-
How can I prevent my control to be serialized in design-mode?Do you mean that you want to check to see if youre running in debug or release mode?
-
How can I prevent my control to be serialized in design-mode?You're serializing a control? I didnt even think that you could serialize a control.
-
How can I prevent my control to be serialized in design-mode?Need more info.
-
save/load an arraylist without serializationWhat type of objects are you storing? Classes? Structs?
-
VBer new to VB.net - handles divide by zero?What percentage of applications you bought and run on your desktop were written in VB ? Good point. I actually prefer C# and I am at least as good in C# as I am in VB. But I'm starting college Monday and part of the course is learning VB.net. I have a love hate relaionship with it... On one hand, I love writing programs in it because, well... its easy. On the other hand, I hate having to tell people that its written Visual Basic.
-
VBer new to VB.net - handles divide by zero?If you cast n1 / n2 to an integer...
lblOut.Text = CInt(n1 / n2)
It will throw a divide by zero exception. Not sure why that is, but setting a labels text returns 'Infinity'. Dont forget, despite the huge, widespread use of VB, its not a real programming language. You cant write halfway decent programs with VB.net because it sucks so much. (Sarcasm intended) -
Newbie hereDim str As String str = "Marks = ""69"" Grades = ""C"""
Where ever you want to put quotes inside of a string use "" So this --> 1 "2" 3 would be coded as "1 ""2"" 3". EDIT: Christian and I posted at the same time. -
Why public sub new()Public Sub New() is whats called the constructor for a class in VB. In there, you can set variables to default values, or other stuff thats required for the class to work properly. C# is a little different...
-
Password GeneratorThis will generate a password of random characters with a length of 10 characters. You could modify this to include the date as part of the generation process.
Private Sub btnGeneratePassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGeneratePassword.Click Dim RandomNo As New Random Dim x As Integer Dim y As Integer Dim Chars As String Chars = "1234567890abcdefghijklmnopqrstuvwxyz" Chars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()[]{};:<>?/.," Count = CInt(numLength.Text) txtPassword.Text = "" For y = 0 To 10 ' Number of chars in password If chkUseSpecial.Checked Then x = RandomNo.Next(0, Chars.Length - 1) Else x = RandomNo.Next(0, Chars.Length - 24) End If txtPassword.Text += Chars.Chars(x) Next End Sub
PS: Codeproject could do a better job at formatting the code above!:sigh: -
How to change a control into an array?' For array of text boxes Dim txtBoxArray as TextBox() Dim x as Integer For Each ctl As Control In Me.Controls If TypeOf ctl Is TextBox Then ReDim Preserve txtBoxArray(x) txtBoxArray(x) = ctl x += 1 EndIf Next
You can access them like txtBoxArray(0), txtBoxArray(1), ect...