|
Learning comes from experience so, try to tackle your problem with starting off with the design or the User interface (UI). After doing the buttons and so on you can then get into coding it.
Try searching Google for answers.
|
|
|
|
|
Perhaps you should reply to the original poster instead of me?
---
b { font-weight: normal; }
|
|
|
|
|
When I build this activex .dll using vb.net 2005 I cannot see the .dll in my list of .com references, also using vb.net
If I use:
imports Classlibrary2.Tester
then my vb.net program can see the class tester, but not the function Testfunction()
What am I missing?
Thanks!
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<assembly: assemblytitle("classlibrary2")="">
<assembly: assemblydescription("")="">
<assembly: assemblycompany("")="">
<assembly: assemblyproduct("classlibrary2")="">
<assembly: assemblycopyright("copyright="" ©="" 2006")="">
<assembly: assemblytrademark("")="">
<assembly: comvisible(true)="">
'The following GUID is for the ID of the typelib if this project is exposed to COM
<assembly: guid("3fd0e39e-7392-4a00-a399-378cbef42b45")="">
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <assembly: assemblyversion("1.0.*")="">
<assembly: assemblyversion("1.0.0.0")="">
<assembly: assemblyfileversion("1.0.0.0")="">
'NOW THE CODE
Public Class Tester
Dim i As Integer
Public Function TestFunction() As Integer
Return 99
End Function
End Class
|
|
|
|
|
You can't just throw a class together and expect it to work under COM. You have to decorate your class, methods, properties, and events with the appropriate attributes. Read this[^] for more information.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
OK, I'm going to try to digest all that.
Would you or anyone have a template vb.net program that successful exposes a .net component to the com environment? I can't find any on the site
ty
|
|
|
|
|
The template depends on what version/edition of VS.NET you're using. It comes with VB.NET 2005 Professional and above.
There is no template in any other versions.
You can find examples of how to do this here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello again.
Thanks to your help I have been able to create an active-x control .dll that I can read from a vb.net program!!! thanks!!
However, the control does not seem to be visible to other programs. I have checked the "expose the control to com" checkbox before I compiled.
Is there a way to diagnose the visibility of such a control?
Thanks!
|
|
|
|
|
Well I've discovered some issues; perhaps these might help someone explain to me my problem.
1. Depends.exe shows that the .dll I've created cannot find MSJAVA.DLL Well I can't find that file anywhere on my computer. Why would my compiled vb.net 2005 active-x .dll need that file?
2. When I try to register the .dll using regsvr32, I get:
"Classlibrary3 was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found."
I rebooted to clear memory and still got the same error. Why can't my .dll be registered?
thanks!
|
|
|
|
|
Probably because you're using REGSVR32 when you should be using REGASM[^].
Keep in mind that VB.NET and C# cannot build an actual ActiveX control in the classical sense. They can generate something that behaves like one, but it is only a COM wrapper around a managed-code assembly that makes it look like that to the consumer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi guys:
I create a form with a bunch of combo boxes, and i named them with: cbo0,cbo1,cbo2.....
I would like to create a function to test if any of them is empty. So i did it this way:
Dim combos(6) As Object
Dim cnt As Integer
Form_Load() Handles MyBase.Load
For cnt = 0 To 6
combos(cnt) = "strLand" & cnt.ToString
Next
End Sub
Private Function checkCbos() As Boolean
Dim cbos As ComboBox
For cnt = 0 To 6
cbos = CType(combos(cnt), ComboBox)
If cbos.Text = "" Then
errorPro.SetError(cbos, "Do not leave the factor box empty!")
End If
Next
End Function
and after all this, i countered a casting error, could anyone helps me to debug this, or have a better idea to validate those combo boxes?thanks very much.
Cheers
Kevin
|
|
|
|
|
Try something like this. You might have to modifiy the code a little I don't have VS open so I don't think it will compile, but it will give you the right way to go about doing this.
<br />
for each item as control in form.controls<br />
if item.GetType is GetType(ComboBox) then<br />
if item.Text = "" then<br />
errorPro.SetError(cbos, "Do not leave the factor box empty!")<br />
end if<br />
end if<br />
next<br />
Mike Lasseter
|
|
|
|
|
Something like this:
Private Function checkCbos() As Boolean<br />
Dim myControl As Control<br />
<br />
For Each myControl In Me.Controls<br />
If TypeOf myControl Is ComboBox Then<br />
If myControl.Text = "" Then<br />
'Set error provider<br />
errorPro.SetError(myControl, "Do not leave the factor box empty!")<br />
'Return False and exit to calling procedure <br />
Return False<br />
Else<br />
'Clear the error provider<br />
errorPro.SetError(myControl, "") <br />
End If<br />
End If<br />
Next myControl<br />
<br />
'If code gets to here, no combo's text is ""<br />
Return True<br />
<br />
End Function
Steve
|
|
|
|
|
Thanks Mike and Steve,i got the point, that is very helpful.
|
|
|
|
|
Hi Steve, ur code only checks a single combox and returns false if the control text is empty. I add a integer to count, and make sure all the boxes are checked. Add 1 if it is not empty.
Private Function checkCbos() As Boolean
Dim myControl As Control
Dim count As Integer = 0
For Each myControl In Me.Controls
If TypeOf myControl Is ComboBox Then
If myControl.Text = "" Then
'Set error provider
errorPro.SetError(myControl, "Do not leave box empty!")
'Return False and exit to calling procedure
Else
'Clear the error provider
errorPro.SetError(myControl, "")
count += 1
End If
End If
Next myControl
'If code gets to here, no combo's text is ""
If count = 6 Then
Return True
Else
Return False
End If
End Function
|
|
|
|
|
Well, it will check all combo boxes but only return an error for one at a time.
Presumably you call checkCbos() in your Save button 'click' procedure?
The function will set an error provider on the first combo box that contains "" and then exit the function. If you select an item and then click your Save button again, you will be notified of any further combos containing "".
This way, if you added another combo box at any time, the code will still work.
The way you have done it is fine but would fail if you added another combo at any time. If it works for you though, that's great!
Steve
|
|
|
|
|
I am working on project... Like a shell and my question is.
Is it possible to turn off windows keys like (WinKey+D), (Winkey+S),etc.
And other that can stop application. Its a program like a desktop and u can only use icons on it not other programs and other. Its for an gaming place. Please help me.
I need anny help and suggestions.
Thanks
|
|
|
|
|
Maybe this CP article and its references can help (link[^])?
Best,
Jun
|
|
|
|
|
Thanks Jun... that will help me i allredy did my own taskmanager and a firewall that terminate all windows forms that are not mine in secconds...
|
|
|
|
|
Hii Friends,
Can we change the color of a particular row in the datagrid according to the conditions we code.
For e.g. if suppose in the datagrid, values which is retrieved from one database table is matching the values of another table the color of the particular row should change to blue or red or any color.
Is it possible.
Waiting for reply..
Bye..
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
This good posting by Frank Kerrigan will probably point you in the right direction. http://www.codeproject.com/aspnet/PrettyDatagrids.asp.
Good luck,
Tim Robertson
Dallas, Georgia
|
|
|
|
|
I want to read data directly into my visual basic application, how can i do it and what resources are required.
I am a student
|
|
|
|
|
First, you need a barcode scanner. How you write your code depends entirely on how that scanner works, so dig out the documentation on the scanner.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Help please.. Can anyone there resolve this?
-Sample Code-
System.Net
...
'let's assume there are other codes here
dim Addr as IPAddress
With DNS.GetHostByName(<compname>)
Addr = System.Net.IPAddress(.AddressList(0).Address)
End With
...
That should have been the way to get the IP Addresses, but in VBNET 2003
the line: "(.AddressList(0).Address)" is obsolete.. Anyone knows the new way?? Be grateful for the help..
Thanks in advance..
|
|
|
|
|
Since you got that "obsolete" message, you're using VB.NET 2005. Check out the Dns class and its GetHostAddesses[^] method.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hmm.. but i'm using Visual Studio 2003.. anyways do u know another way? Hope u can help me.. i'm still lookin for another way though.. Thanks
|
|
|
|