|
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[^]
|
|
|
|
|
yeah u r right eddy.. thnx
|
|
|
|
|
Yes, it is. It's just not the answer you want.
|
|
|
|
|
Hi all.
I want to detect keys events only from a phisical keyboard in VB6,don't respond a virtual keyboard's.How can I do it?
Thank you.
|
|
|
|
|
First off, VB6 is long since dead. You really have no reason to be doing new development work in it as Visual Studio 2013 Express is FREE!
Next, it depends on how the virtual keyboard is stuffing keystrokes and what your application is doing. It may come down to you implementing a global keyboard hook, but this may not work depending on the virtual keyboard.
You may not have any way to figure out the difference.
The question is why would you want to?
|
|
|
|
|
Thank you Dave Kreskowiak.
Maybe I must go into Visual Studio 2013 Express tomorrow.But I only want to realize this with VB6 now,not a more advanced version.It's said with the scanCode of tagKBDLLHOOKSTRUCT,even with the other members in this structure,we can discriminate them.If the soft keyboard neglected it.Any adivse is welcome.
Thank you again.
|
|
|
|
|
Like Dave recommended to you, drop VB6. Pick up VB.NET or C#.
For the keyboard issue, this article might be of help: Using Raw Input from C# to handle multiple keyboards[^]
It's in C#. If you go with VB.NET you could just use it as a referenced DLL. Or maybe use some code-translator[^] to translate it into VB.NET.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi, Sascha Lefévre.
I have searched the information about Raw Input in your link and MSDN.It's a good suggestion.I will take some days to get it.
Thanks for your help.
|
|
|
|
|
I have a bindingsource bound to an entity.
When the bindingsource has at least one item , I can get the item's data type with :
MyBindingSource.Current.GetType
But how can I do in the case when bindingsource has no items ?
I try this :
MyBindingSource.GetItemProperties(Nothing)(0).ComponentType
But doesn't work.
Thank you !
modified 17-Apr-15 12:15pm.
|
|
|
|
|
Hello !
I'm using entity Framework (Database First ) with a SQL Server Database.
I have a situation where I have an object ( that is an entity object ) , but the type is known only on runtime ).
I need to get the Primary key property name and the Foreign key property name ( for a specific relation)
for example
MyObj (ObId , name , val1)------- ( ObID is primary key )
MyChild (ChlID ,dt , MyObj_ID) --- ( CHLID is primary Key , Myobj_ID is foreign key)
Dim obj1
.....
Get_PK(obj1)
I want that the possible function Get_PK to return a string with the value :
- "ObID" ( if the type of the object is MyOBJ) , or "ChlID" if the object is of the type MyChild.
and the function Get_Parent(obj1,chl1) to return "MyOBj_ID"
But of course it must be a general function that works with every class inside the entity.
Actually I have 2 functions :
Public Function Get_pk(ctx As MyEntities, entity As Object) As String
Dim objectContext = DirectCast(ctx, System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext
Dim t As Type = entity.GetType.BaseType
Dim m As MethodInfo = objectContext.GetType().GetMethod("CreateObjectSet", New Type() {})
Dim generic As MethodInfo = m.MakeGenericMethod(t)
Dim st As Object = generic.Invoke(objectContext, Nothing)
Dim entitySetPI As PropertyInfo = st.GetType().GetProperty("EntitySet")
Dim entitySet As Metadata.Edm.EntitySet = DirectCast(entitySetPI.GetValue(st, Nothing), Metadata.Edm.EntitySet)
Dim keyNames As IEnumerable(Of String) = entitySet.ElementType.KeyMembers.Select(Function(k) k.Name)
Return keyNames(0)
End Function
This is for Primary Key property , and is working , but is is slow ( I'm thinking if Entity framework has a built in method to get this directly ??? )
Public Function Get_FK(ctx As MyEntities, entity As Object, parenttable As String) As String
Dim fk = entity.MetadataWorkspace.GetItems(Of Metadata.Edm.AssociationType)(Metadata.Edm.DataSpace.CSpace).Where(Function(a) a.IsForeignKey)
Dim fkname = fk.Where(Function(x) x.ReferentialConstraints(0).ToRole.Name = parenttable)
Dim refcol = fkname.Select(Function(x) x.ReferentialConstraints(0).FromProperties(0).Name).First()
return refcol
End Function
This is for the foreign key (related with a parenttable that is passed as parameter ). This is not working. I get an error in the first line because entity is a proxy object and MetaDataWorkspace is not a member of proxy types. and I don't know if this function works at all.
What can I do ?
Thank you !
modified 17-Apr-15 12:15pm.
|
|
|
|
|
For the Primary key :
Public Function Get_PK(ctx As MyEntities, entity As Object) As String
Dim objectContext = DirectCast(ctx, System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext
Dim t As Type = entity.GetType.BaseType
Dim m As MethodInfo = objectContext.GetType().GetMethod("CreateObjectSet", New Type() {})
Dim generic As MethodInfo = m.MakeGenericMethod(t)
Dim st As Object = generic.Invoke(objectContext, Nothing)
Dim entitySetPI As PropertyInfo = st.GetType().GetProperty("EntitySet")
Dim entitySet As Metadata.Edm.EntitySet = DirectCast(entitySetPI.GetValue(st, Nothing), Metadata.Edm.EntitySet)
Dim keyNames As IEnumerable(Of String) = entitySet.ElementType.KeyMembers.[Select](Function(k) k.Name)
Return keyNames(0)
End Function
For the Foreign key :
Public Function Get_FK(ctx As MyEntities, entity As Object, parenttable As String) As String
Dim objectCont = DirectCast(ctx, System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext
Dim t As Type = entity.GetType.BaseType
Dim m As MethodInfo = objcont.GetType().GetMethod("CreateObjectSet", New Type() {})
Dim generic As MethodInfo = m.MakeGenericMethod(t)
Dim st As Object = generic.Invoke(objcont, Nothing)
Dim entitySetPI As PropertyInfo = st.GetType().GetProperty("EntitySet")
Dim entitySet As Metadata.Edm.EntitySet = DirectCast(entitySetPI.GetValue(st, Nothing), Metadata.Edm.EntitySet)
Dim elementtype = entitySet.ElementType
Dim entitymember = elementtype.NavigationProperties.Where(Function(t1) t1.ToEndMember.Name = parenttable)
Return entitymember.First.GetDependentProperties.First.Name
End Function
Please give me some reputation , because I found the answer
|
|
|
|
|