|
Ok , I give you some additional details :
I'm using the form to edit , create and modify records form a database.
The button for which I'm talking has all the necessary code to test the new record created by user , and if the test is done without problems , the new record is saved. But this button can test and save records one by one ( so if a user create a new record , he should press the button before create another ).
Now , I have added a new function in my form : Copy paste records.
So the user can select one ( or several ) existing records , and press copy on the right click menu.
When a copy is made , a list is created that contains all the records that are copied and should be pasted.
for the Paste actions , I have this For..next loop.
But the records that are copied , should be pasted one by one.
So a new record is created that is a copy of the first element on the copy-list.
At this point , the loop should stop , and user can make the changes needed for this copy and after should press the button to do the actions needed and to save this record.
After the loop can continue with the same logic for the other records.
This is all.
Can you give me a new idea ?
Thank you !
|
|
|
|
|
dilkonika wrote: for the Paste actions , I have this For..next loop.
But the records that are copied , should be pasted one by one.
So a new record is created that is a copy of the first element on the copy-list.
At this point , the loop should stop , and user can make the changes needed for this copy and after should press the button to do the actions needed and to save this record.
After the loop can continue with the same logic for the other records.
From this description you have given I would consider 2 approaches to your problem
- The user has to individually copy / edit a duplicated row and then click on save
- You allow the user to specify how many rows that they want to create, then allow them individually save each row.
personally I feel if you continued on the path that you want to take it, It would make your application very hard to maintain.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
This isn't something you would normally do, and prior to .NET 4.5 would be virtually impossible. (You could re-write your code to use a state-machine, but it wouldn't resemble a For loop.)
However, if you're using .NET 4.5, you can create a hacky solution using Async / Await :
Private _buttonClickedSource As TaskCompletionSource(Of Boolean)
Protected Sub MyButton_Click(ByVal sender As Object, ByVal args As EventArgs) Handles MyButton.Click
Dim tcs As TaskCompletionSource(Of Boolean)
tcs = Interlocked.Exchange(_buttonClickedSource, Nothing)
If tcs IsNot Nothing Then
tcs.TrySetResult(True)
End If
End Sub
Private Async Function DoYourFunkyThing() As Task
...
For i = 1 To nr1
...
If condition1 Then
Dim tcs As New TaskCompletionSource(Of Boolean)()
Interlocked.Exchange(_buttonClickedSource, tcs)
MyButton.Enabled = True
Await tcs.Task
MyButton.Enabled = False
End If
Next
End Function
The compiler will re-write this method to use a state machine, but you can still write your code as if it was a For loop.
Async (Visual Basic)[^]
Asynchronous Programming with Async and Await (C# and Visual Basic)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks to all for your down Votes.
It's seems that those who doesn't have the idea how to resolve the problem , attack the question. Sorry friend what do you want , to ask : " ... It's true that 1+1=2 ?"
It's sure that for this question exist a solution ( even prior to .NET 4.5 )
( for sure , it's not me that found the solution , because I don't pretend to be a high level professional ).
But I will not post here the solution.
Maybe some of those that have down voted , try to find the answer , because someone that pretend to have a professional level , should show this with an answer not with a down vote.
|
|
|
|
|
Yeah, about the reputation...
|
|
|
|
|
And why have you posted this abusive response to my message, when I've tried to help you?
Your account is currently on 8 "abusive/troll" votes. Two more, and you'll be kicked off the site.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
and what is the abusive part of my post ?
If you are one of them that down voted , well , sometimes the truth is hard to accept.
|
|
|
|
|
I posted a genuine answer to your question.
You replied with a message complaining about down-votes, and stating that you found an answer elsewhere, but you're not going to share it with us because none of us are "professional" enough.
And you can't see the abusive part of that?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Maybe was a mistake from me that I posted my replies to your message.
My replies was intend to be a general replies to all of those that have down voted. Because I think each down vote should have an argumentation.
And I found the answer elsewhere ( it is not my solution ) , but I don't post here only for those that have down voted. ( if you are one of them , this is for you too). The reason is that I think that when someone doesn't know the solution , attack the question. For these people I thing that they aren't professional.
Instead of simply down vote a question :
1) Find a solution
2) Ignore the question
3) Say " I'm sorry I don't know "
4) Down vote , but with arguments why this question has problems.
|
|
|
|
|
dilkonika wrote: My replies was intend to be a general replies to all of those that have down
voted. That'd be me.
dilkonika wrote: And I found the answer elsewhere ( it is not my solution ) , but I don't post
here only for those that have down voted. Not a downvote, but an abuse-flagging. It is not something that is flagged on a question, but on an account. Read his post again.
dilkonika wrote: The reason is that I think that when someone doesn't know the solution , attack
the question. More likely cause would be being rude against volunteers.
dilkonika wrote: For these people I thing that they aren't professional. This is spare time, you should not be expecting a business-treatment.
dilkonika wrote: Instead of simply down vote a question : Demands are hardly going to work. There's some basic rules for the forum as a sticky on top of each page. I think it is worded correctly.
Instead of making demands, try kindness.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
dilkonika wrote: and what is the abusive part of my post ? The part where you tell a professional that is trying to help you that he should not have posted an answer.
It is saying you want explanation in words, not code - and demand code five minutes later.
dilkonika wrote: sometimes the truth is hard to accept. Yes, a recurring theme.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Are you as well reminded of a certain member by a(nother?) member posting a couple of questions here recently?...
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Yes, but it appears to be in a different tone than this thread.
Time will tell
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Public Class Form1
Private Function getCrc16(b() As Byte, nLen As Integer) As UInt16
Static crctab16() As UInt16 = _
{&H0, &H1189, &H2312, &H329B, &H4624, &H57AD, &H6536, &H74BF, _
&H8C48, &H9DC1, &HAF5A, &HBED3, &HCA6C, &HDBE5, &HE97E, &HF8F7, _
&H1081, &H108, &H3393, &H221A, &H56A5, &H472C, &H75B7, &H643E, _
&H9CC9, &H8D40, &HBFDB, &HAE52, &HDAED, &HCB64, &HF9FF, &HE876, _
&H2102, &H308B, &H210, &H1399, &H6726, &H76AF, &H4434, &H55BD, _
&HAD4A, &HBCC3, &H8E58, &H9FD1, &HEB6E, &HFAE7, &HC87C, &HD9F5, _
&H3183, &H200A, &H1291, &H318, &H77A7, &H662E, &H54B5, &H453C, _
&HBDCB, &HAC42, &H9ED9, &H8F50, &HFBEF, &HEA66, &HD8FD, &HC974, _
&H4204, &H538D, &H6116, &H709F, &H420, &H15A9, &H2732, &H36BB, _
&HCE4C, &HDFC5, &HED5E, &HFCD7, &H8868, &H99E1, &HAB7A, &HBAF3, _
&H5285, &H430C, &H7197, &H601E, &H14A1, &H528, &H37B3, &H263A, _
&HDECD, &HCF44, &HFDDF, &HEC56, &H98E9, &H8960, &HBBFB, &HAA72, _
&H6306, &H728F, &H4014, &H519D, &H2522, &H34AB, &H630, &H17B9, _
&HEF4E, &HFEC7, &HCC5C, &HDDD5, &HA96A, &HB8E3, &H8A78, &H9BF1, _
&H7387, &H620E, &H5095, &H411C, &H35A3, &H242A, &H16B1, &H738, _
&HFFCF, &HEE46, &HDCDD, &HCD54, &HB9EB, &HA862, &H9AF9, &H8B70, _
&H8408, &H9581, &HA71A, &HB693, &HC22C, &HD3A5, &HE13E, &HF0B7, _
&H840, &H19C9, &H2B52, &H3ADB, &H4E64, &H5FED, &H6D76, &H7CFF, _
&H9489, &H8500, &HB79B, &HA612, &HD2AD, &HC324, &HF1BF, &HE036, _
&H18C1, &H948, &H3BD3, &H2A5A, &H5EE5, &H4F6C, &H7DF7, &H6C7E, _
&HA50A, &HB483, &H8618, &H9791, &HE32E, &HF2A7, &HC03C, &HD1B5, _
&H2942, &H38CB, &HA50, &H1BD9, &H6F66, &H7EEF, &H4C74, &H5DFD, _
&HB58B, &HA402, &H9699, &H8710, &HF3AF, &HE226, &HD0BD, &HC134, _
&H39C3, &H284A, &H1AD1, &HB58, &H7FE7, &H6E6E, &H5CF5, &H4D7C, _
&HC60C, &HD785, &HE51E, &HF497, &H8028, &H91A1, &HA33A, &HB2B3, _
&H4A44, &H5BCD, &H6956, &H78DF, &HC60, &H1DE9, &H2F72, &H3EFB, _
&HD68D, &HC704, &HF59F, &HE416, &H90A9, &H8120, &HB3BB, &HA232, _
&H5AC5, &H4B4C, &H79D7, &H685E, &H1CE1, &HD68, &H3FF3, &H2E7A, _
&HE70E, &HF687, &HC41C, &HD595, &HA12A, &HB0A3, &H8238, &H93B1, _
&H6B46, &H7ACF, &H4854, &H59DD, &H2D62, &H3CEB, &HE70, &H1FF9, _
&HF78F, &HE606, &HD49D, &HC514, &HB1AB, &HA022, &H92B9, &H8330, _
&H7BC7, &H6A4E, &H58D5, &H495C, &H3DE3, &H2C6A, &H1EF1, &HF78}
Dim fcs As UInt16 = &HFFFF
For i = 0 To nLen - 1
fcs = (fcs >> 8) Xor crctab16((fcs Xor b(i)) And &HFF)
Next
Return Not fcs
End Function
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim s As String = "0D0103588990532174470001"
Dim inp(s.Length \ 2 - 1) As Byte 'allocate byte array storage assumes string length is even, 2 chars per hex byte
For i = 0 To inp.Length - 1 'for each byte in the array
inp(i) = Convert.ToByte(s.Substring(i * 2, 2), 16) 'convert 2 hex chars from the string into a byte value
Next
TextBox1.Text = (getCrc16(inp, inp.Length).ToString("X"))
End Sub
End Class
This is VS2010(vb.net) code i want to convert it in visual basic 6.0.
is there any one who can solve this issue??? this codding is useful to calculate crc itu error check..
|
|
|
|
|
|
FYI (for future recommendations): Visual Studio 2013 Community[^] is basically a VS Pro and free for non-enterprise use (same for the upcoming VS 2015). VS Express is mostly useless now.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Yeah, I know about it. I just forgot because I'm running on about 4 hours of sleep and not doing good...
|
|
|
|
|
Or Visual Studio Community[^], which is essentially a free version of VS2013 Professional, with some minor usage restrictions.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thnx for reply dear but its not answer of my question..
|
|
|
|
|
It would not make sense to translate working code into a dead language.
Use it in the language it is in, and call it from your VB6 application.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
it is not dead language anymore coz my application in vb6 running in the market since 2004 dear.. i earn money from it.. if u dont have knowledge or no ans of my question than doesnt mean to waste time @both end.
|
|
|
|
|
I am not your dear. VB6 is no longer supported, and has not been sold for a long time.
hitu4u067 wrote: i earn money from it. So, what? That does not mean that it will be magically supported. It works the same as claiming that you are going to open a store for betamax video's.
hitu4u067 wrote: if u dont have knowledge or no ans of my question than doesnt mean to waste time @both end. "I am only going to accept ansers I like"?
Not a very productive attitude
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hitu4u067 wrote: it is not dead language anymore coz my application in vb6 running in the market since 2004
Just because you use the language doesn't mean Microsoft will support the the VB6 runtime indefinitely. At some point in the near future you will be upgrading your application to .NET if you still want to sell your application or any new applications you write. Get up to speed on .NET now before you're forced to do it when you have no time to.
hitu4u067 wrote: i earn money from it..
So, are you going to open a store that sells these[^] too?
hitu4u067 wrote: dear
In the West, unless it's your girlfriend or wife, you don't refer to anyone as "dear".
|
|
|
|
|
i dont like to waste my time unnecessarily my friend. if u guys have ans thn its ok..no prob else
|
|
|
|
|
hitu4u067 wrote: i dont like to waste my time unnecessarily my friend You've asked for advice on a public forum, and received it.
There's more people that are still working in VB6, but no new code is written in the language - so new code would be written in an up-to-date and supported language. You can than call that from your existing VB6-application.
There's also no good reason to stay working in VB6; VB.NET is available for free, and is supported. You'll find that most books sold on VB are aiming a VB.NET.
..and anything in VB6 could stop working "tomorrow", depending on the Windows-update settings. That's why I'm hammering on the fact that it is no longer supported. Don't expect me to give you an answer that is already invalid and outdated once I type it.
I'll accept that there's cultural differences and that I may sound rude.
My apologies.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|