|
Hi all,
I solved the problem simply changing the first line of code (definition of function)
Public Function ReadField(ByVal NameArray As String, ByVal Field As Integer) As String
With this one:
Public Function ReadField(ByRef NameArray() As String, ByVal Field As Integer) As String Thanks fo help
Ignazio
|
|
|
|
|
Hello All I am having a hard time sending some email attcahments i looked all over google and youtube and i this ways of doing it and thay dont work for me i click the button and it just sits thare and do noting i take out the attachment line and it sends me a email no problem
can any one help
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyMailMessage As New MailMessage
Try
MyMailMessage.From = New MailAddress("FromEmail@gmail.com", "To Display Name")
MyMailMessage.To.Add("ToEmail@hotmail.com")
MyMailMessage.Subject = ("Status for " & TextBox1.Text)
MyMailMessage.Body = ("System status for " & TextBox1.Text & " save and open with Excel")
MyMailMessage.Attachments.Add(New Attachment("C:\Data.xls"))
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("FromEmail@Gmail.com", "Password")
SMTP.Send(MyMailMessage)
MsgBox("msg sent")
Catch ex As Exception
and i also tryed it like this i see now it is pretty much the same thing
Dim Data As New Attachment("c:\date.xls")
MyMailMessage.Attachments.Add(Data)
Thanks in advnace every one
|
|
|
|
|
I'm using something like the code below and it works fine for me.
' Create the mail message
Dim mail As New MailMessage()
' Set the addresses
mail.From = New MailAddress("FromEmail@gmail.com")
mail.To.Add("ToEmail@hotmail.com")
' Set the content
mail.Subject = "The subject..."
mail.Body = "The message body..."
' Add an attachment
mail.Attachments.Add(New Attachment("Path to attachment"))
' Send the message
Dim smtp As New SmtpClient("smtp.gmail.com")
smtp.Credentials = New System.Net.NetworkCredential("username", "password")
smtp.EnableSsl = True
Try
smtp.Send(mail)
Catch e As Exception
......
Finally
mail.Dispose()
smtp = Nothing
End Try
Regards
Nuri Ismail
modified on Wednesday, September 9, 2009 11:55 AM
|
|
|
|
|
Still not working for me i take the attatchem line out and it send the mail i put it back then i get noting
This is what i put
Thanks Agine
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Mail As New MailMessage()
Mail.From = New MailAddress("FromMail@gmail.com", "Display Name")
Mail.To.Add("ToMail@hotmail.com")
Mail.Subject = "Status for " & TextBox1.Text
Mail.Body = "System status for " & TextBox1.Text & " save and open with Excel"
Mail.Attachments.Add(New Attachment("C:\Data.xls"))
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("FromMail@Gmail.com", "Password")
Try
SMTP.Send(Mail)
Catch ex As Exception
Finally
Mail.Dispose()
SMTP = Nothing
End Try
End Sub
|
|
|
|
|
Did you try to send the e-mail without setting the SMTP port to 587? I know that default one (25) is not the best because of security issues but on gmail Problems sending mail[^] page i found this:
If you tried configuring your SMTP server on port 465 (with SSL) and
port 587 (with TLS), but are still having trouble sending mail, try
configuring your SMTP to use port 25 (with SSL).
The size of the attachments could also be a problem:
Also note that with Gmail, you can send and receive messages up to 20
megabytes (MB) in size.
I think that your problem could be connected with the used port or with the attachment itself. You can check out the above link for another possible reasons.
Regards
Nuri Ismail
|
|
|
|
|
I try port 25 465 and 587 with and with out ssl and it still dod not work
i dont think the size of the file is a problem it is only 1k
|
|
|
|
|
i got it working now
i have inported this
Imports System.Net.Mail
and then i found on google a guy hade it like this
Imports System.Net.Mail
Imports System.Net.Mime
Imports System.ComponentModel
and it worked
Thanks for you help man
|
|
|
|
|
Hello, I'm wandering is it possible to read file bit by bit in visual basic ? I know how to ready byte by byte
If it is, please tell me how, or give me link to the page to read something
Thanks
|
|
|
|
|
|
Thank you very much !! Great link
|
|
|
|
|
Hi all,
I have two queries, which I have solved halfway.
First Query:
I want to find the Username who has logged on to a Computer, the computers IP address and Hostname.
I have written the code to find the Hostname and IP address but not the Username.
I would like all these information on a file, which I have already done except for the Username.
Code sofar:
Private Sub LogOutput_IP(ByVal logFile As String, ByVal msg As String)
Using sw As StreamWriter = New StreamWriter(logFile, True)
Dim theDate As Date = Now()
Dim strHostName As String
Dim strIPAddress As String
strHostName = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()
Dim sb As StringBuilder = New StringBuilder(theDate.ToString)
sb.Append(vbTab & msg)
sb.Append(vbTab & "Host Name: " & strHostName)
sb.Append(vbTab & " IP Address: " & strIPAddress)
sw.WriteLine(sb.ToString)
End Using
End Sub
I call this sub in a button click event and works fine.
Output obtained:
I want help to write the Username who is currently using the Computer.
Second Query:
As of now The LP.txt file is created in a folder in C drive.
I wish to create this file in a server or another PC(say admins computer), how to achieve this?
Any help will be helpful.
Thanks in Advance.
modified on Tuesday, September 15, 2009 7:54 AM
modified 28-Nov-12 8:01am.
|
|
|
|
|
|
Thanks for you reply.
I had a search on the internet and found a solution to get the username of the logged on user.
GetUserName
I would be happy if I get a solution to solve the second query.
|
|
|
|
|
vijay2482 wrote: Second Query:
As of now The Log_IP.txt file is created in a folder in C drive.
I wish to create this file in a server or another PC(say admins computer), how to achieve this?
First you can create the file on your machine and after that you can upload this file to server or another PC. This can be done by using My.Computer.Network.UploadFile Method[^].
Here[^] are some examples and you can find many more using google.
Regards
Nuri Ismail
|
|
|
|
|
Thanks again.
I want this file to be created only once, say the file is created in the server or admins system.
each time a user logs on, the logging needs to be appended on to that file.
I will check the link that you have provided.
|
|
|
|
|
vijay2482 wrote: I want this file to be created only once, say the file is created in the server or admins system.
each time a user logs on, the logging needs to be appended on to that file.
In this case you can use the File.AppendText Method[^]. It will create a StreamWriter object for you. If the file specified by the path parameter does not exist, it will be created. If the file does exist, write operations to the StreamWriter will append text to the existing file. According to MSDN the path parameter of the File.AppendText method can be the path to the file on your server:
'From MSDN
In members that accept a path, the path can refer to a file or just a directory.
The specified path can also refer to a relative path or a Universal Naming Convention (UNC)
path for a server and share name. For example, all the following are acceptable paths:
* "c:\\MyDir\\MyFile.txt" in C#, or "c:\MyDir\MyFile.txt" in Visual Basic.
* "c:\\MyDir" in C#, or "c:\MyDir" in Visual Basic.
* "MyDir\\MySubdir" in C#, or "MyDir\MySubDir" in Visual Basic.
* "\\\\MyServer\\MyShare" in C#, or "\\MyServer\MyShare" in Visual Basic.
The above quote can be found here[^] and it applies to all of the members of File class.
I hope this helps you!
Best wishes,
Nuri Ismail
|
|
|
|
|
Thanks for the link.
I will checkout.
|
|
|
|
|
Hi All,
I'm beginner in visual baics PLS assist me hw to approach
|
|
|
|
|
|
first learn to spell basic.
I would suggest working through a book like Visual Basic .NET in 24 hours or equivent dummy's guide book.
This should give you a foundation to start with.
Then pick yourself a simple project to hone your newly acquired skills.
If possible, attend evening classes at a local college. It usually helps if you learn with a group, because you can bounce ideas off each other.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I hate those 'learn x in y hours' books, they rarely do any good or explain concepts that are paramount for successful projects, even the smallest of such.
|
|
|
|
|
Yes, but they're a good starting point for the absolute beginner as they will cover some of the basic features of the IDE as well as the basics of the language in question.
I should have also said, move for the VB in 24 hours books to something like "Professional VB.NET" and don't rule out books on programming concepts including OOP and database design.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks all for valuable suggestions
I'll keep working and post queries
|
|
|
|
|
hi all.
am using vb.net 2.0 with sql2000, i need some help how to create pie chatrs
Regards
Vidhish
|
|
|
|
|
If you have literally no idea, a forum reply is not going to fix it for you. Your best bet is to search for a library, or buy one.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|