|
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
|
|
|
|
|
In an existing vb.net 2010 application, I want to sum the values contained in column # 5 in a collection called _dt.
The following is the code for how the specific column is accesed when it is to be displayed on the internet :
Dim _dt As DataTable = New DataTable
For i = 0 To _dt.Rows.Count() - 1
_htmlTable.Append("Total # parts: " + _dt.Rows(i)(_dt.Columns(5).ColumnName()).ToString() + " ")
_htmlTable.Append("<BR />")
Next
I basically want a total value for this specific column. Can you show me the code of how I can sum the value that is contained in column #5 of the code that I listed above?
|
|
|
|
|
1) Declare a variable outside your for-loop that has the same type as that column.
2) Inside the for-loop add the value that you already display as string to that variable.
3) After the for-loop append the value of that sum-variable to your StringBuilder.
Unrelated:
Exactly like you access the column in the column-collection of the table by its index:
_dt.Columns(5)
..you can access the column of a row by its index. So your detour via the column-name is completely unneccessary. Instead of:
_dt.Rows(i)(_dt.Columns(5).ColumnName()).ToString()
..you can write:
_dt.Rows(i)(5).ToString()
And: You already use the StringBuilder - then you could use it also to replace the string-concatenation here:
_htmlTable.Append("Total # parts: " + _dt.Rows(i)(5).ToString() + " ")
..like so:
_htmlTable.Append("Total # parts: ").Append(_dt.Rows(i)(5).ToString()).Append(" ")
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
|
You're welcome!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hello !
It's possible to create a list of unknown type at compile time ?
Let's suppose the type is in one variable as a string.
And I want to create a list of this type , and of course after I want to add items from this type to the list.
I have found this code on C# , but it seems not work on vb.net :
Type customList = typeof(List<>).MakeGenericType(tempType);
IList objectList = (IList)Activator.CreateInstance(customList);
object o = objectThatContainsListToCopyFrom;
PropertyInfo p = o.GetType().GetProperty("PropertyName");
IEnumerable copyFrom = p.GetValue(o, null);
foreach(object item in copyFrom) objectList.Add(item);
foreach(object item in objectList) { Debug.WriteLine(item.ToString()); }
I just want to create the list , and after to add items like this :
List1.Items.Add(object).
What can I do ?
Thank you !
|
|
|
|
|
That looks like it should work in C#. What problem do you have with the VB-translation?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|