Been struggling with this for a while now..
I'm perfectly able to create a working .NET Composite-control, which works fine in an aspx website.
I'm able to create in umbraco a macro for a .net homemade user control and pass parameters to it, this works fine on the umbraco-website as well.
Problem is the combination of both. I would like to create a macro in umbraco for the composite control I've created, but I'm not able to get it right.
Here I chose '.NET Custom Control' because my composite-control is a vb.class only (and the '.NET user control needs an .ascx page) As Assembly I chose the name of the dll (without the extension As Type I took 'NAMESPACE.CLASSNAME'
But then I'm getting this error:
'System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)'
What I'm doing wrong here?
Thx.
Did you try it with .dll in assembly name? also whats is your namespace and name of the class?
Regards
Isamil
Related
I have an ascx.vb file with a function that starts off like this:
Sub buildlist()
repcaldatelist.Visible = True
...
End Sub
I'm just trying to figure out what repcaldatelist is. When I use VS's "Go To Definition", it gives me a popup saying "The definition of the object is hidden." Using "Go To Implementation" does nothing.
I see the corresponding .ascx file with this line:
<asp:repeater ID="repcaldatelist" runat="server">
and I see how repcaldatelist is databound to it, so that page can display its data.
But what I'm trying to understand is, where does repcaldatelist come from? I want to see where it's initialized and what its type is.
I know this is probably really basic but I'm new to VB / Web User Controls and haven't had any luck searching for this online thus far. Please enlighten me.
ID="repcaldatelist" means that's the ID of the Repeater control. So in your .vb file, repcaldatelist is an object of type Repeater - the ID in the ascx/html translates into a variable name in the VB. If you hover over the variable in the .vb file in Visual Studio it should tell you the type as well.
Go To Definition / Implementation don't work because the Repeater class is part of the .NET framework, and it's closed-source - just a DLL on your machine. Therefore there's no source code or definition you can view. You just have access to its public API as defined by the docs (and should be available in intellisense as well).
I have visual c++ .dll file which I have added as the reference in VB.Net project. That created Interop.mydlllib.dll.
Now I want to use the function having three parameters from dll inside my one function.
How to call this VC++ dll function inside my VB.Net function.
I'm very new to VB.Net, so any help is appreciated... :)
(I searched on the internet and tried the ways suggested there...but still error ... :( )
If you've referenced a Dll inside a VB project, then you will simply need to call it from it's namespace.
I.e. inside the C++ project there will be something (Probably the application/dll name) that it will register itself under.
From here, you simply need to start typing for intellisense to kick in and you'll see the name of your Dll listed in the dropdown list. Select that name and you should see your function name that you'll be able to call.
I am trying to create a UserControl in VB.net, under VS2010. I have the code for the UserControl and I would like to add it to a form. My problem is that, according to every book and forum I have seen, after I build the UserControl, it should show up in the Toolbox. It doesn't. I even downloaded code from a book, the code executes perfectly, but their TrafficLight control doesn't go in the Toolbox (even though the book says it should - and that the only way to set its properties and to add it to the form is through the Control properties). I have tried to add the control to the form manually, by declaring it
Dim myObj As New SomeClass.SomeControl
and in the Designer.vb, identical with the buttons on the form:
Friend WithEvents myObj As SomeClass.SomeControl
With both, I get an error saying
'myObj' is already declared as 'Friend WithEvents myObj As SomeControl' in this class.
And either way, I get an error when I try to look at the design:
Could not find type 'SomeClass.SomeControl'. Please make sure that the assembly that contains this type is referenced. If this type is part of your development project, make sure the project has been successfully built using settings for your current platform or AnyCPU.
The control by itself builds and shows up in design view (not in the Toolbox though, even though it Imports System.ComponentModel and Inherits System.Windows.Forms.UserControl and... what else ? I tried to build it in a separate project, to see if I creating a separate dll will make a difference, though I really want it in the same project.
Please help ! (BTW I have reinstalled VS2010 and it did no good)
Thank you.
Look in Tools / Options / Windows Forms Designer and set "AutoToolboxPopulate" to True (but note that this can take a noticeable amount of time if you haver many (i.e. dozens) of user controls.
I do apologize if this post is a duplicate, but I haven't found anything similar when I searched.
I'm fairly new to VB.NET and I'm currently playing around with user controls, figuring out good programming practices. As far as I understand, to create and use a UserControl, I need to create a project with the UserControl in it, then build the project and use that DLL (add it to Toolbox or otherwise).
My question is this: Is there a way a have a project (a Form with a bunch of things on it) that contains a UserControl written in a *.vb file inside that same Project? If you do that, the DLL (in my case) never gets produced, possibly because the UserControl is never used and building it is simply omitted. Is it perhaps a bad practice to do that altogether? It simply makes sense to me to keep a UserControl as a part of the Project that uniquely uses it. Is there a reason not to do that?
Thanks in advance! = )
SOLUTION:
Visual Studio does not automatically include your own controls to the toolbox by default! In order to change that, go to Tools>Options>Windows Form Designer>General and set AutoToolboxPopulate to True. When you build your project next time, your new Control will appear in your Toolbox.
It's a perfectly valid design decision to include a UserControl in a WinForm or WPF project that uses it. If you do this then VS will not create a DLL for the UserControl; instead the UserControl will be built into the assembly your project is producing.
If you did want to reuse a UserControl in multiple projects then you would want to create separate project that generates a DLL that can be reused.
Trying to get it to behave like C#, where there is a Program class with a static Main method.
However, in the project properties, I cannot set Program.vb to be the startup object, only the forms (it is a forms application).
Am I missing something?
I am using the VS2010 and the latest VB.
Uncheck Enable Application Framework in Project Properties.
You need to switch off “Application Framework” on the main page of the project settings.
The application framework provides its own entry point which sets up a few things that are subsequently used (e.g. application events, single instance checks etc.) and then just displays the main form using System.Windows.Forms.Application.Run. That’s why you can only supply the main form, not a custom entry point method.