|
What approaches have you tried doing besides serializing/deserializing?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
First sorry for the late answer but I was on holiday for the past 10days
So far I have tryed saving only the printername (using default settings then) but this doens't give us enough control over the printing.
I'v tryed to save more settings (pages,marges,...) but then there is the problem what to save because there are alot printers out there with specific needs.
I haven't found any better way than to serialize the settings to have all the settings in one place
any idea's are welcome
|
|
|
|
|
hi all,
how can i perform extractaction and compression of files using vb.net (without WINZIP or WINRAR mean using windows Utility or something else)
|
|
|
|
|
Private Sub Compress(ByVal Filename As String)
Dim targetfile As String = IO.Path.ChangeExtension(Filename, "zdx")
Using sr As New IO.FileStream(Filename, IO.FileMode.Open)
Using sw As New IO.FileStream(targetfile, IO.FileMode.OpenOrCreate)
Using gZip As New IO.Compression.GZipStream(sw, IO.Compression.CompressionMode.Compress, False)
Dim buffer(sr.Length) As Byte
sr.Read(buffer, 0, buffer.Length)
gZip.Write(buffer, 0, buffer.Length)
gZip.Flush()
gZip.Close()
End Using
sw.Close()
End Using
sr.Flush()
sr.Close()
End Using
End Sub
Here is the code to uncompress,
Private Sub UnCompress(ByVal filename As String)
Dim targetfile As String = IO.Path.ChangeExtension(filename, "doc")
Using sw As New IO.FileStream(targetfile, IO.FileMode.OpenOrCreate)
Using sr As New IO.FileStream(filename, IO.FileMode.Open)
Using gZip As New IO.Compression.GZipStream(sr, IO.Compression.CompressionMode.Decompress)
Dim buffer(sr.Length) As Byte
gZip.Read(buffer, 0, buffer.Length)
sw.Write(buffer, 0, buffer.Length)
End Using
End Using
End Using
End Sub
|
|
|
|
|
hi,
m new for the asp.net. will be glad if someone gives me an idea on how to download the file residing the the server folder from the client browser.
i googled many sites but haven't yet found the solution, though have already known how to upload into the server.
|
|
|
|
|
1st Solution
http://www.google.com/search?hl=en&q=asp.net+download+file[^]
Still, if you can not find than somewhat like this...
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition","attachment; filename=SailBig.jpg");
Response.TransmitFile( Server.MapPath("~/images/sailbig.jpg") );
Response.End();
|
|
|
|
|
I am knew in Programming. I am working in VS2005 prof and using VB code. I want to see all the members in a Group in active directory and write the members names and the group name to a Excel file. I know nothing about working with active directory. All I have is the LDAP. Please can someone help me???
|
|
|
|
|
|
My bad "new" in programming. I do not know how to code in C#. all i want is just the names of the members in a group.
I have a OU with groups in them. need to reed in every group the members and copy them in a excel file
|
|
|
|
|
I am using VB 6. I exported table data into Microsoft excel sheet. Now I have to export data into Sun's OpenOffice excel format. What I have to do for this? Can any body help?
I used Excel.Application and Excel.worksheet for Ms. excel. What I have to for Open office?
Tnx in adv.
Balasubramanian K.
|
|
|
|
|
Try oooforum.org. You might find something there.
|
|
|
|
|
It would probably be easier to export it to CSV (if that's an option). That way you can open it in almost any program.
|
|
|
|
|
i can easily add single image in the mail but the error is when i try to add two images it picks only last one. below is the code in mail i get teh last image "DB" i want to get both images how can i get that.
Dim strHTML As String
strHTML = mmMailMsg1.Body.ToString.Replace("DM", "cid:DM")
strHTML = mmMailMsg1.Body.ToString.Replace("DB", "cid:DB")
View = System.Net.Mail.AlternateView.CreateAlternateViewFromString(strHTML, Nothing, "text/html")
resource = New System.Net.Mail.LinkedResource("E:\..\PC Case.jpg")
resource.ContentId = "DM"
resource1 = New System.Net.Mail.LinkedResource("E:\..\Stuff 3.jpg")
resource1.ContentId = "DB"
View.LinkedResources.Add(resource)
View.LinkedResources.Add(resource1)
mmMailMsg1.AlternateViews.Add(View)
Dim objSMTPClient As New System.Net.Mail.SmtpClient()
objSMTPClient.Host = System.Configuration.ConfigurationManager.AppSettings("ServerMail").ToString()
objSMTPClient.Send(mmMailMsg1)
|
|
|
|
|
Have you tried creating multiple views, adding a single image to each view, and then adding all the views to the message object?
My advice is free, and you may get what you paid for.
|
|
|
|
|
I have tried with Mutiple views also but the problem is still the same i get the last image.
If i try to send mail through CDO then i can easily attach as many images as i want but with SMTP it is giving problems
|
|
|
|
|
I managed to make my VB.Net application a single instance application by checking Process Id in Sub Main(). Now I want to load a form from existing running instance of the application. Can anybody guide me that how I can obtain an instance name by using hWnd?
Thanks in advance.
|
|
|
|
|
|
Many thanks for your reply. But it is not exactly what I need. My requirements are :
1- To check for an existing instance.
2- To load a form from existing instance based on command line parameter value (if found).
I have already ckecked for previously running instance and it works fine. What I need is to load a form from already running instance and perform search in existing instance. I have managed to obtain the hWnd value of runnig instance but don't know how to call form / function by using this hWnd value. I will appreciate for your help.
Thanks
|
|
|
|
|
research mutex...exactly what you want
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I want to send my cursor to catch in try / catch block when one of my condition doesn't meet
how can i acheive that ?
Please look into the following code that explains a bit:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer
i = Val(Me.txtErrMsg.Text)
Try
If i = 4 Then
' If i = 4 then I want to go to catch and display the message Now throwing exception
Else
Me.txtErrMsg.Text = "Normal"
End If
Catch ex As Exception
Me.txtErrMsg.Text = "Now throwing Exception"
End Try
End Sub
When i = 4 then I want to go to catch and show the message how can I do that ??
Thanks in advance
|
|
|
|
|
|
That isn't actually a good answer. You are using the exception handling system to modify regular program flow rather than respond to exceptional events. Exceptions are very expensive to handle and should not be used unless the thing throwing the exception is a very unusual case that you don't expect to happen, but need to handle if it does.
You also say in your blog post that "in the catch part you can do all your garbage collection and closing the instances." That is a very bad idea. It means you have to write the code twice, once for the good cases where everything works, and once for the bad cases, where things don't work out. What you should be really doing is creating a Finally block so that the resrouces get cleaned up regardless of whether the method ended well, or not.
|
|
|
|
|
Your code would be better written as:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer
i = Val(Me.txtErrMsg.Text)
If i = 4 Then
Me.txtErrMsg.Text = "Now throwing Exception"
Else
Me.txtErrMsg.Text = "Normal"
End If
End Sub
Exceptions are expensive. They take many clock cycles as the runtime has to figure out how to back out of what ever it was doing.
|
|
|
|
|
I would like to make a game loop but at the same time I need complete control over the form. I used the following concept but ran into a serious problem. The moment the loop is entered nothing else responds.
This is a windows forms application using vb.net 2008.
I added a module
Module Game
Public Finished as Boolean = False
Public Sub Start()
While Not Finished
My.Application.DoEvents()
End While
End Sub
End Module
The 'Start' sub procedure is called from the forms load even and that is the entire program. When run, the form does not even show up. I don't want to add Me.Show() before running the loop since it defeats the purpose if it's stuck anyway. I need the loop to run while at the same time I need full access to the controls on the form without any stalling or pausing. Does anyone know how to make a properly functioning loop run in parallel to the form?
|
|
|
|
|
You should be spawning a thread for your loop, there are many articles and threads here to help with threading.
Never underestimate the power of human stupidity
RAH
|
|
|
|