|
hmmm, greatly appreciate your help...your suggestion tells me a lot.
Checking the forum, for me at least, is sometimes the way for optimizing the development time, of course, when people are willing to share their experience with others, allowing those others to take advantake of their skill, their trial and error, their optimizing etc.
When people are not willing to share, well, then of course there is a huge amount of things out there you can reach via BigG.
Nothing personal, but why should people spend time on feeding and maintaining specific and specialized forum(s), if the final goal is fooling around with Google?
Cheers.
SepPax
|
|
|
|
|
Look at the question you asked:
SepPax wrote: something more advanced to suggest? So what are we to guess from that? How much more advanced, what level of experience do you have that we can respond to ... ? As you see it's an impossible question to answer. I suggest you read http://www.codeproject.com/Messages/1278601/How-to-get-an-answer-to-your-question.aspx[^]. Only by thinking carefully about exactly what problem you are facing, and providing a clear explanation, can we begin to think of ways to help you.
|
|
|
|
|
Well Richard,
can't say you are wrong... will try my best to improve
SepPax
|
|
|
|
|
Hi guys,
getting crazy about this issue, can't figure out the reason. I'm sure that a more skilled eye than mine can get the point, any help is welcome.
I get the below error (see end of the code).
Basically I have a decoding function feeded with a key (pbKey), an input array (pbIn) and an output array (pBout).
Don't understand what VB is asking for...
Seppax
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim k As Byte() = {&H1F, &H33, &H52, &H59, &H02, &H04, &H77, &H67, &H13, &H0E, &H00, &H15, &H15, &H02, &H0F}
Dim dat As Byte() = {&H5F, &H4F, &HDA, &HA3, &H97, &H14, &H81, &HB1}
Dim s, a As String
Dim out As Byte()
TeaD(k, dat, out)
End Sub
Private Function TeaD(ByVal pbKey() As [Byte], ByVal pbIn() As [Byte], ByVal pbOut() As [Byte]) As Byte()
Dim i As [Byte] = New [Byte]()
Dim y As UInteger
Dim z As UInteger
Dim sum As UInteger = &HC6EF3720UI
Dim delta As UInteger = &H553569AAUI
Dim n As UInteger = 32
Dim k(4) As UInteger
y = pbIn(2)
z = pbIn(6)
k(0) = pbKey(2)
k(1) = pbKey(6)
k(2) = pbKey(10)
k(3) = pbKey(14)
For i = 0 To 2
y <<= 8
z <<= 8
k(0) <<= 8
k(1) <<= 8
k(2) <<= 8
k(3) <<= 8
y = y Or pbIn(2 - i)
z = z Or pbIn(6 - i)
k(0) = k(0) Or pbKey(2 - i)
k(1) = k(1) Or pbKey(6 - i)
k(2) = k(2) Or pbKey(10 - i)
k(3) = k(3) Or pbKey(14 - i)
Next i
Do While n > 0
z -= ((y << 4) Xor (y >> 5)) + y Xor (sum + k(sum >> 11 And 3))
sum -= delta
y -= ((z << 4) Xor (z >> 5)) + z Xor (sum + k(sum And 3))
n = n - 1
Loop
For i = 0 To 3
pbOut(i) = y
pbOut(i + 4) = z
y >>= 8
z >>= 8
Next i
End Function
|
|
|
|
|
You didn't initialize your byte-array-variable out(), resp. pbOut(). You just declared it in Button1_Click(..). Looks like you want to want to write to its indices 0 to 7, so you would have to initialize it like so:
Dim out As Byte() = New Byte(7) {}
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Many thanks Sascha!
From your answer I understand that by doing so I need to fix the dimension on the array.
From the original purpose, pbIn() and pBout() could have variable length...would there be a way to handle this?
SepPax
|
|
|
|
|
SepPax wrote: From your answer I understand that by doing so I need to fix the dimension on the array. Well, you need to initialize the variable for the array with an instance of an array. Array-variables are references and declaring them (e.g. Dim out As Byte() ) only yields a null-array-reference (or 'Nothing'-array-reference) that can but not yet has been assigned an actual array.
The 'dimension' is a different thing: You have declared a one-dimensional array here and there's (probably) nothing wrong with that. You might want to take a look at the MSDN page talking about arrays:
https://msdn.microsoft.com/en-us/library/wak0wfyt.aspx[^]
SepPax wrote: From the original purpose, pbIn() and pBout() could have variable length...would there be a way to handle this? That's the trouble with arrays: If you don't know beforehand how 'large' they have to be it get's a bit ugly, because they can't dynamically grow. Of course you could deal with that yourself but it's much more convenient to use a suitable collection-class then which will handle this for you. I guess a generic list would make sense in your case:
Dim out As New List(Of Byte)()
Please refer: List<T>[^]
SepPax wrote: Many thanks Sascha! You're welcome!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
got everything working as expected.
Thanks.
SepPax
|
|
|
|
|
cheers!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi,
I stored a file in my database table. The file is converted to binary, Now i want To retrieved the file back and save it to my selected location in my desktop.
Can anyone show me the code on how to do this. I am working on a form/windows based.
Thanks & Regards
--careLess
|
|
|
|
|
I dislike giving search results as an answer but did you even look at these results[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Please take a look at this code below to point out I am missing because it throws an exception on the Smtpserver.Send(mail)----Faillure sending mail
Here is the code:
Private Sub Btnsend_email_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsend_email.Click
Try
'create the mail message
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage
'set the addresses
SmtpServer.Credentials = New System.Net.NetworkCredential("wnmichaud@gmail.com", "password")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
mail.From = New MailAddress("wnmichaud@gmail.com")
mail.To.Add(wnmichaud@yahoo.com)
'set the content
mail.Subject = "Hello"
mail.Body = "Dear Mr. Michaud"
'send the message
SmtpServer.Send(mail)
MsgBox("Done")
Catch ex As Exception
MsgBox(My.Settings.ERROR_msg, vbCritical, "Error")
End Try
End Sub
'---------------
Thanks a lot!
|
|
|
|
|
Check ex._innerException.
If it is "The remote name could not be resolved:" then the SMTP Port/Host is not configured for the supplied values.
There are strangers on the Plain, Croaker
|
|
|
|
|
You may need the following extra parameters set:
SmtpServer.EnableSsl = true;
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.UseDefaultCredentials = false;
|
|
|
|
|
Hello everyone
I added those extra parameters:
SmtpServer.EnableSsl = true;
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.UseDefaultCredentials = false;
-------------------------
SmtpExxeption was caught with the failure sending mail.
Again thank you for your assistance
|
|
|
|
|
You need to dig further into the exception to find out exactly why it is failing. Without that information it is impossible to offer any better suggestions. Use your debugger and examine all the details inside the exception object.
|
|
|
|
|
That's the problem with showing just the message; try to messagebox "ex.ToString()" and you'll get a lot more details on what went wrong
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Dear all
Here are the exception errors:
System.Net.Mail.SmtpException:Failure sending mail
System.Net.WebException:Unable to connect to the remote server
System.Net.Sockets.SocketException:No connection could be made because Target machine actively refused the connection: 74.125.136.108:587
Thanks
|
|
|
|
|
That error means either there is a firewall in the way between you're machine and the server or there is no server listening on that address/port.
Your connection IP and port values are probably not set correctly.
|
|
|
|
|
If this is the first time you are using your gmail account to send emails programmatically, you'll also need to login to email and there should be a message somewhere in there asking if you are OK with some application trying to send emails using your account.
It's a security feature of gmail. I don't recall where the message showed up, but that happened to me.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello community,
does anyone know a control which fulfills these requirements:
- Bindable to datacolumns of datetimeoffset type
- Nullable
- offering input assistance, e.g. dropdown-calendar
The datetimepicker control would just hit the spot, but it doesn't deal with datetimeoffset values (which are needed in my case).
I found a Nullable DTP here: Nullable DTP, which works great - on Datetime. Not Datetimeoffset. And as it's derived from Datetimepicker, which uses Datetime, it's no use...
Any hints?
Thanks
Martin
modified 4-May-15 8:27am.
|
|
|
|
|
WPF does
Oh, I'm serious. You can tailor the control as you please, so It wouldn't be a problem.
|
|
|
|
|
Hmm... but can I use WPF controls in Winforms? If yes, how? Winforms may be oldfashioned, but "the customer wants it"...
Thanks
Martin
|
|
|
|
|
|
No, I'm afraid WPF is not an option. My customer wants it done in Winforms, as he doesn't have any IT-people to keep a WPF application running.
Thanks!
Martin
|
|
|
|