|
d@nish is saying you need to purchase a book and read it.
That is what Dave said as well, in fact all replies are suggesting you need to learn vb.net.
|
|
|
|
|
I disagree with the others. Your code is perfect. It's a masterpiece of obsfucation. I'm sure when you're trying to maintain it, that the extra time you take will go right onto your hourly rate, and I'm sure that writing code this hard to read means that the client will never find anyone else willing to work on it.
Seriously, when professionals tell you that you need to update your skillset, your options are to accept their advice, or assume that everyone is an idiot except for you. People I've known who do the latter, tend to end up unemployed.
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.
|
|
|
|
|
Hi,
I agree with you when say that my code is a masterpiece of obsfucation, but this is my "unwanted" style.
The advantage is that it is a "natural obsfucation".
I ensure that it works, and it is to selectively read fields contained in text-records (lines) stored in an Array. Fields (of each record) are separated by commas. The record is selected in a comboBox.
Absolutely it's not true that when professionals tell me that I need to update my skillset, my options are to accept their advice, or assume that everyone is an idiot except for me!
For me doesn't exist the second of yours options.
For me the possible options are 3: Accept, Consider, Not accept.
But in no case Not accept can means to consider others idiot, of course!
I find strange if you consider only the 2 options, you written.
Ignazio
|
|
|
|
|
Hurricane3000 wrote: For me the possible options are 3: Accept, Consider, Not accept.
Well, you need a reason to not accept. Either we're all stupid, or we're right.
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.
|
|
|
|
|
If your last want be a question, I think that it will remains an "unaswered question" because yours is a "wrong question".
Boolean matematich says that for each element(bit) added to a binary word, possible combinations are doubled.
For example:
If a binary word have only 1 bit, possible combinatins are 2.
If a binary word have 4 bit, possible combinatins are 16.
If a binary word have 8 bit, possible combinatins are 256.
In your question you not specified the word "All" how many bits have.
If "All" have more than 1 element(bit), the minimum possibilities to consider are 4.
Example: 00,01,10,11 (not only 00 or 11).
More, if words are minimum 2, to these can be applied following operators:
And, Nand, Or, Nor, XOr, Not-XOr, with a lot of further possibilities.
|
|
|
|
|
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.
|
|
|
|