|
thx daveauld I fix iT!??
Thx ALot!?
|
|
|
|
|
hi
set the connection object 'con' to the command object e.g
com.Connection = con
do not forget to close the connection e.g. con.Close() aftre the dt.Fill(dt) call.
regards
|
|
|
|
|
Dear Freind,
This is Ganesh Joshi,working as a Beginner of vb.net Developer,i have used a datagrid on a form and also a command button.On the commant button click event a text Box is being open.
My Requirement : If I type any value in text Box then Datagrid Should Be filtered as per given value of.
If I type in text box raj then focus should goes on particular raj name grid.
|
|
|
|
|
That is too generic a question and it is not clear exactly what you are trying to filter. Where is the datasource, is it attached to a database query etc.
Try to explain a bit more of the specifics if you want help.
|
|
|
|
|
Dear All,
I greated small application in VisualStudio2005 to send email with attach file to all my company's customer which take their email from database. So the sending mail process is in loop.
I tested lot time . i change their mail to my mail and friends for test. When i click button "Send Mail" it process is complete but i and friend didn't get any mail.
Note: our company has to usedd mail server as well. I created a Function like bellow:
and Function bellow i imports name space or reference ready.
What is issue of this prople?
Please give me idea or solution. thanks
Under is my function which created.
Function SendEmail(ByVal mBody As String, ByVal mSubject As String, ByVal mFrom As String, ByVal mTo As String, Optional ByVal mCC As String = "", Optional ByVal mBCC As String = "", Optional ByVal pDisplayName As String = "", Optional ByVal pIsBodyHtml As Boolean = False, Optional ByVal pPriority As MailPriority = MailPriority.Normal, Optional ByVal AttPath As String = "") As Integer
Dim Mail As New System.Net.Mail.MailMessage
Dim counter As Integer = 0
Dim MailAddList() As String
Dim MailList As String
Dim Smtp As New SmtpClient
Try
With Mail
.From = New System.Net.Mail.MailAddress(mFrom.Trim, pDisplayName)
'---- Insert Recepient mail(To) ----
MailAddList = Split(mTo, ";")
For Each MailList In MailAddList
.To.Add(MailList)
Next
.Priority = pPriority
.IsBodyHtml = pIsBodyHtml
'---- Insert CC ----
If mCC <> "" Then
MailAddList = Split(mCC, ";")
For Each MailList In MailAddList
'.To.Add(MailList)
.CC.Add(MailList)
Next
End If
'---- Insert Bcc ----
If mBCC <> "" Then
'.Bcc.Add(mBCC.Trim)
MailAddList = Split(mBCC, ";")
For Each MailList In MailAddList
.Bcc.Add(MailList)
Next
End If
.Subject = CStr(mSubject).Trim
.Body = mBody.Trim
.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
'Atach File
AttFileName = New Attachment(AttPath)
Mail.Attachments.Add(AttFileName)
End With
Smtp.Host = CStr("company.test.com.kh") 'It's replace the IP
Smtp.Port = 25
Dim myCredential As New System.Net.NetworkCredential("UserName", "Password")
Smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
Smtp.Credentials = myCredential
Smtp.Send(Mail)
'----- Delay process 10seconds ------'
System.Threading.Thread.Sleep(10000)
'-----------------------------------'
Return 0
Catch ex As Exception
ErrorMessage = ex.Message
Return -1
Finally
If Mail IsNot Nothing Then Mail.Dispose()
Mail = Nothing
Smtp = Nothing
End Try
End Function
VB.Net
modified on Sunday, January 17, 2010 10:09 PM
|
|
|
|
|
Can you reformat your original post and stick the code in a pre block? that would make it easier to read for a starter. also sort out your blocks.
|
|
|
|
|
Function SendEmail(ByVal mBody As String, ByVal mSubject As String, ByVal mFrom As String, ByVal mTo As String, Optional ByVal mCC As String = "", Optional ByVal mBCC As String = "", Optional ByVal pDisplayName As String = "", Optional ByVal pIsBodyHtml As Boolean = False, Optional ByVal pPriority As MailPriority = MailPriority.Normal, Optional ByVal AttPath As String = "") As Integer
Dim Mail As New System.Net.Mail.MailMessage
Dim counter As Integer = 0
Dim MailAddList() As String
Dim MailList As String
Dim Smtp As New SmtpClient
Try
With Mail
.From = New System.Net.Mail.MailAddress(mFrom.Trim, pDisplayName)
'---- Insert Recepient mail(To) ----
MailAddList = Split(mTo, ";")
For Each MailList In MailAddList
.To.Add(MailList)
Next
.Priority = pPriority
.IsBodyHtml = pIsBodyHtml
'---- Insert CC ----
If mCC <> "" Then
MailAddList = Split(mCC, ";")
For Each MailList In MailAddList
'.To.Add(MailList)
.CC.Add(MailList)
Next
End If
'---- Insert Bcc ----
If mBCC <> "" Then
'.Bcc.Add(mBCC.Trim)
MailAddList = Split(mBCC, ";")
For Each MailList In MailAddList
.Bcc.Add(MailList)
Next
End If
.Subject = CStr(mSubject).Trim
.Body = mBody.Trim
.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
'Atach File
AttFileName = New Attachment(AttPath)
Mail.Attachments.Add(AttFileName)
End With
Smtp.Host = CStr("company.test.com.kh") 'It's replace the IP
Smtp.Port = 25
Dim myCredential As New System.Net.NetworkCredential("UserName", "Password")
Smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
Smtp.Credentials = myCredential
Smtp.Send(Mail)
'----- Delay process 10seconds ------'
System.Threading.Thread.Sleep(10000)
'-----------------------------------'
Return 0
Catch ex As Exception
ErrorMessage = ex.Message
Return -1
Finally
If Mail IsNot Nothing Then Mail.Dispose()
Mail = Nothing
Smtp = Nothing
End Try
End Function
VB.Net
|
|
|
|
|
I would suggest you first try and break down the issue into smaller chunks and build it up progressively.
1) Start by searching this forum, this has been discussed before many times and there are definitely code samples available (i know because i posted one for sending email via gmail, the process is the same, just different ip's + ports)
2) Is your SMTP port correct? doesn't look like a standard SMTP port (usually 25)
3) Does your SMTP require authentication?
4) Try sending a basic text message first, single hardcoded email address, with no attachments does that work?
Build on it from there.
|
|
|
|
|
I test manually that send to 2 email (yahoo, and gmail) and cc 1 email (our company mail) with attach file. When i check i got in gmail. around 5 or 6 hour i got in our company mail. But about yahoo i don't get it at all.
I don't know that is issue.
If have any solving please let me know.
gold_sovann@yahoo.com
Thanks
VB.Net
|
|
|
|
|
Maybe you have some spam filters as part of the yahoo mail turned on. This is just canning the message.
Did you try sending a basic message without any attachments etc. to yahoo, did this work?
The fact you received the message on gmail and company mail would suggest it is working and it is the mail providers causing the loss of message.
|
|
|
|
|
By the way i tested to send it.
i got testing mail it was in Spam folder not into Inbox.
why is like that?
and when i test send to 7 or 8 customer with loop i did not get mail.
What problem ?
VB.Net
|
|
|
|
|
The problem is your message must look like its is being dumped by all the mail servers because it looks like SPAM. Pure and simple.
You have already said it is sending the messages and they are being received by some account, and not others. And even one appeared in the spam folder.
Change the layout of your message, add more text into the body, have a decent subject, give the attachments meaningful names etc. etc. all these things will reduce the likelihood of it being interrupted as spam.
|
|
|
|
|
Thanks you Dave.
I will try to test it again.
If you have any new of that issue please let me know.
Best regards
VB.Net
|
|
|
|
|
Hi all,
Is it possible to merge two pdf file into one using vb.net and how ?
I google it but it seems. you need to download a pdf utility or third party application. Is there a way in vb.net that will not use some utilities?
Thanks in advance.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
There is a libary called PDF metamorphosis. It, I guess, is an open source and written in .Net. You can take a look at it and it might help you out.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
C#Coudou wrote: Is there a way in vb.net that will not use some utilities?
Yes, you write all the code yourself.
MVP 2010 - are they mad?
|
|
|
|
|
I am feeling very good today.
Download iText Sharp .NET library[^] to start with.
The you will want this to wrap around it.
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Public Class PDFMerge
#Region "Fields"
Private _sourcefolder As String
Private _destinationfile As String
Private _fileList As IList = New ArrayList()
#End Region
#Region "Properties"
'''
''' Gets or Sets the SourceFolder
'''
Public Property SourceFolder() As String
Get
Return _sourcefolder
End Get
Set(ByVal value As String)
_sourcefolder = value
End Set
End Property
'''
''' Gets or Sets the DestinationFile
'''
Public Property DestinationFile() As String
Get
Return _destinationfile
End Get
Set(ByVal value As String)
_destinationfile = value
End Set
End Property
#End Region
#Region "Public Methods"
'''
''' Add a new file, together with a given docname to the fileList and namelist collection
'''
Public Sub AddFile(ByVal pathnname As String)
_fileList.Add(pathnname)
End Sub
'''
''' Generate the merged PDF
'''
Public Sub Execute()
MergeDocs()
End Sub
Public Sub Execute(ByVal Destination As String)
DestinationFile = Destination
MergeDocs()
End Sub
#End Region
#Region "Private Methods"
'''
''' Merges the Docs and renders the destinationFile
'''
Private Sub MergeDocs()
'Step 1: Create a Docuement-Object
Dim document As New Document()
Try
'Step 2: we create a writer that listens to the document
Dim writer As PdfWriter = PdfWriter.GetInstance(document, New System.IO.FileStream(DestinationFile, System.IO.FileMode.Create))
'Step 3: Open the document
document.Open()
Dim cb As PdfContentByte = writer.DirectContent
Dim page As PdfImportedPage
Dim n As Integer = 0
Dim rotation As Integer = 0
'Loops for each file that has been listed
For Each filename As String In _fileList
'The current file path
Dim filePath As String = SourceFolder + filename
' we create a reader for the document
Dim reader As New PdfReader(filePath)
'Gets the number of pages to process
n = reader.NumberOfPages
Dim i As Integer = 0
While i < n
i += 1
document.SetPageSize(reader.GetPageSizeWithRotation(1))
document.NewPage()
'Insert to Destination on the first page
If i = 1 Then
Dim fileRef As New Chunk(" ")
fileRef.SetLocalDestination(filename)
document.Add(fileRef)
End If
page = writer.GetImportedPage(reader, i)
rotation = reader.GetPageRotation(i)
If rotation = 90 OrElse rotation = 270 Then
cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, _
reader.GetPageSizeWithRotation(i).Height)
Else
cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, _
0)
End If
End While
Next
Catch e As Exception
Throw e
Finally
document.Close()
End Try
End Sub
#End Region
End Class
Use the Destination property to set the merged PDF location and name
Use the Add method to add the PDF files you want to merge together, in the order you want them merging.
Call the Execute method to perform the merge.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
ok. thank u very much. i'll try this one.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Hi All,
I created a setup package for my project in Visual Studio 2005. I installed on a separate PC and the exe can be run from desktop also. The executable is showing on my desktop but it is not displaying any image/logo/icon etc. I mean, its showing a square shape exe on the desktop.
What I want is, whenever the exe is created on the desktop during installation, I want it to be created as an image or logo or icon. It should be same as we install Visual studio software and a desktop icon is created with title "Visual Studio 2005".
I think I am able to make my requirement clear.
Is there any setting for this during creation of setup file in VS 2005?
Regards,
R.S.
|
|
|
|
|
Your requirement isn't exactly clear. You say you're putting the .EXE file on the Desktop?? Easy. Go intop the project properties and, on the Application tab, there's a little place where you can change the icon used. It gets compiled into the .EXE and NOT done at installation time.
|
|
|
|
|
Okay, I am making a program for my friend to use, he wanted it, so he could decrypt some passwords from his database, and I got the form done, now all I need is the code to where it will decrypt the inputed password(as MD5)... Thanks.
|
|
|
|
|
Didn't you ask this a few days ago.
MD5 is a ONE WAY HASH algorithm, it cannot be decrypted, you can only try to make a database of dictionary pair values and hope you hit the ones you are trying to hack.
Thats right, hack.
No self respecting owner / administrator of data would try to decrypt his members passwords.
|
|
|
|
|
Any decent software will also be salting the hash, so unless it is a straight MD5 standard unsalted hash, even public rainbow tables wont help you.
What application is it that has done the original hash?
|
|
|
|
|
Since, again, MD5 is a one way hash, there is no way to run the hash code through something and get the original string back.
|
|
|
|
|
Before you add the decryption code that people have been refusing to give you so far, why not prepare the documentation, the marketing, the YouTube movie, and the launch event for your new app; by then technology may have evolved sufficiently for getting your problem solved in a single statement?
it can't be done
|
|
|
|