.net - Using Functions And Classes In Another Project?
Mar 12, 2012
I'm refactoring my VB project into 2 projects, one being a utility library that I want to share with future projects.My solution's layout is like this:[code].....
util is created as a class library, and the member files added into it. I've then added util into the main project's references.However, when I try to call functions in util.vb from my main project files, I get build errors like this:
error BC30451: Name 'LogException' is not declared.
error BC30002: Type 'VarFile' is not defined.
These are defined in util.vb, and it compiled fine when it was part of the main project. The declarations look like this: (I've trimmed out the details)[code].....
I can add util.vb "as link" into the main project and it will solve all the build errors, but that seems to defeat the purpose of refactoring out the class library - I would like to develop this library separately, and not always have to keep track of which file links I haven't added in my main project.
I have a Module in VB.NET called Math.vb and in that module, I created a Function that displays returns the percentage of one number to another. I have a Sub that calls the Function and I call the Sub from my Form1 class. Is there an advantage/disadvantage to putting the function in the class or the module?
The way my code is now its all basically in one class and I want to move different functions into other classes to organise it a bit.What is the best way to do this as I have been having problems I was just bringing in a new Main class when I needed to call the functions in my main class but this would give errors when I run the program and not let me run it?
Private mc as new Main()mc.functionNeeded But the error when I try to run"Stack over flow exception"
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
Any tips on how this is done. I couldnt find any info on it (probably because its so basic)
I am integrating two disparate data sources where each value may depend on one or more other derived elements.This app runs as a windows service.Currently all my code is in a single class.I am upgrading to 2010 and wondering if best practices would be to break out my functions into multiple classes - there are over 100 data elements that need to be constructed. The following is an example of a couple derived items:(Is there a better way to do this - when complete I will pass this app off to someone else to support and want to make sure I give them the best beginning.[code]......
Is it considered an acceptable practice to use Modules instead of Classes with Shared member functions in VB.Net?I tend to avoid Modules, because they feel like left over remains from VB6 and don't really seem to fit in anymore. On the other hand, there doesn't seem to be much difference between using a Module and a Class with only Shared members.
I would like an overview of System.EventArgs. I have an understanding of System.Object where I can pass data between subroutines and functions using Public Classes. I am curious what EventArgs do?
EDIT: The above class is just an example of what could be returned from a web service. I won't have access to modify it at all, sorry if I didn't make that clear.Is it possible to somehow make a clone this class, so that it retains all of the properties values, but hides the fact that there is a Public function?I'd like to be able to take some existing classes we retrieve from a web service(which we didn't write) and be able to pass them on for use in an application, but without exposing the functions. I don't want to go down the route of creating my own classes that specifically define each property and write the values in (due to the sheer size of some of them), so I'm looking to see if there is anything dynamic I can utilise (maybe there is a way using reflection?).
I want to know what are classes , objects , a namespace , subroutines,functions,methods,properties and differemce betweem byval and byref in your words.
I am new to .net and was wondering if there are any projects which have sets of vb.net classes online which i can use. For example we have Flourish — PHP Unframework which has lots of php classes therefore a programmer doesn't not to replicate code on each project. Is there a asp.net (vb) resource website or any open source project which has built in vb.net functions.
Are there any functions that can be called across the project.I mean we cn use Private Sub ABC() function in the document where it has been declared but is there any way that this could be called from any other form?
Are there any functions that can be called across the project.I mean we cn use Private Sub ABC() function in the document where it has been declared but is there any way that this could be called from any other form?
How to insert Left, Right, Mid functions in vb.net project. Presently I am Right function, But An error occurred 'Public read only property right() as integer ' has no parameters and its return type cannot be indexed
I have coded two seperate VB.net windows forms application as two seperate projects in seperate solutions. I now want to combine one project called "Reporting" into the other project called "AnalysisApp" and be able to call the Reporting apps main form.The Reporting app utilies a whole load of controls from DevExpress which are not included in the "AnalysisApp" I have added references in "AnalysisApp" to the DevEpress controls and also to the Reporting app, as well as combining the Reporting app into the same solution, but when I build the "AnalysisApp" it fails saying that it cannot find the DevExpress DLLs
I'm working on a class project where I have to create an item class with private attributes, public get and set methods for the attributes, and two non-access methods. I have two textbooks I work with. The first book is Clearly Visual Basic(Zak) and the second is Programming, Logic, and Design(Farrel). I've set my private attributes but I am having difficulty writing what I want to accomplish in the VB.net language.
Class CD1 Declarations private string cdName private string aristName
I've 2 projects- one containing GUI and another a DLL project containing some implementations. I'm using Classes in DLL in my GUI. All that I wanna do is when some results are manipulated in the DLL, the final output from DLL should be made available in the RichTextBox present in the GUI project. I tried the WithEvents and also Add Handler. But its not working.In the DLL, I added...
Public Event Report(ByVal info As String) RaiseEvent Report("The folder has been Copied.") In the GUI, I added... Public WithEvents Log As RTAF_DLL.CServer // RTAF_DLLis the project name. CServer is the class // in which the event has been writtenLog = New RTAF_DLL.CServer Protected Sub Log_Report(ByVal info As String) Handles Log.ReportMsgBox(info) // Even this is not getting printedMe.RichTextBox2.AppendText(info)End Sub
The problem here is I'm not sure whether or not the event is getting raised. But I set a breakpoint and found that the Event is not handled.I tried including Imports System.Runtime.InteropServicesBut its not working.
I'm making an application that will be available as both a Windows App and an ASP.Net App. The web app has a much scaled-down version of the functionality of the window app. I want to reference the classes contained with the windows app from my web app. The thing is, my classes in the windows app may have some modifications: if I reference them in my web app, will this pick up the changes made automatically? Also, referencing the project is for development work, when I go to deploy the web app, I will probably need to reference the classes as dll's. So the next questions are: 1. Is this the right way to go about doing this? 2. How do I make the Classes I have into self-contained dll files?
I have done a project were I had to recreate a vb project to match the functions of a demo. In the demo the panda is unable to go through the rock. I have tried hard and am unable to stop the panda going through the rock. Please could someone show me how.
I have attached the project below.
The demo is contained in the folder of the file i have attached.
I want to have my own web browser. instructions and code for this project. i try to make but there's some error in my project. codes and other functions?
I am trying to convert a VB.NET project to C#. I am conveting all the forms and classes as required, but I don't know where I need to write the events from ApplicationEvents.vb (I believe its autoGenerated from Properties) Here is the code in my ApplicationEvent.vb file:
i create a class library or use already created class library in my windows service project. I have 1 dll file then how can i use that file in my project.?Logic is my Greatest Asset !
the client has asked for all forms and classes to be hidden from the main project, so when he sells it, they will only be able to see part of the project and not all the classes and forms.My Solution: I have created another project called project2, and added all the forms and classes from main project, fixed all errors and compiled it.I deleted all the forms from the main project and added a reference so that it gets all the forms from the other project by referencing the dll file, but it does not seem to work and get a lot of errors.is there an easier way of hiding the forms and classes from the main project or do I need to do more then just add the reference.
As I develop code, I often want to unit test some of the building blocks of a class even if they are normally private. If my unit tests are inside the project, I can use "Friend" to accomplish this and still keep the functions private for normal use. But I would rather move my NUnit tests into their own separate project(s). How do I achieve the effe vb.net 2005?
I have a main application and the setup project for the app in a single solution.I have custom classes to detect in sql server 2005 express is installed. if it is not I have classes to install it and create my database.Now I need to call the above classes from my setup project before it installs my actual application on a client pc.
I am in college taking computer programming and we are now in multiple classes and forms. It was very hard to get ahold of at first but now that I understand it a bit better I am curious as to how often in a professional enviornment do developers create multiple classes for a project? Besides the use of custom functions what else is beneficial for it?
As I develop code, I often want to unit test some of the building blocks of a class even if they are normally private. If my unit tests are inside the project, I can use "Friend" to accomplish this and still keep the functions private for normal use. But I would rather move my NUnit tests into their own separate project(s).
Yesterday I opened Visual Studio (2008 v 9.0.30729.1) and all the winform classes in my project display with class module icons with the little 'VB', instead of form module icons with the little form icon!
When I double click on a form module, the form designer doesn't open, just the code module.
When I run the project, it runs fine. There are no errors. The project builds fine.
I did Project --> show all files, and I can see the designer and resx files below the form module which doesn't look or act like a form module.