Solved

Need to add a class for an add in i'm writing

Posted on 2006-11-01
9
172 Views
Last Modified: 2010-04-23
Hi there

I'm writing an add in and wanted to know if there was a way in the code i can add a class file in and put it in the project folder

i choose

regards
0
Comment
Question by:davoman
9 Comments
 
LVL 2

Expert Comment

by:Mystify
ID: 17848857
if you right click on your project in the solution explorer and say add existing, browse to your class file and add it. It should copy that file into your projects folder and thus be added.

0
 
LVL 1

Author Comment

by:davoman
ID: 17848877
no sorry i mean doing it in code

Ie when the add in runs as part of it i want a class file to be brought in , in a specific  folder

regards
0
 
LVL 10

Expert Comment

by:gangwisch
ID: 17848997
i dont believe you can do this because you need to have the reference of this file at runtime due to the JIT compiler.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Author Comment

by:davoman
ID: 17849031
buts an add in that is adding a file into another project which is being worked on at the time, I can add all the class code through a builder i just need to be able to add the file
0
 
LVL 11

Expert Comment

by:melmers
ID: 17864495
Do you want to add the sourcecode to your project or the compiled assembly to be used by your software ?
0
 
LVL 1

Author Comment

by:davoman
ID: 17864789
Basically I have created an add in that constructs a whole load of code depending on the developers requirements.

for example

Imports SYSTEM.Data.SQLclient
Public Class  Test

    PRivate _number as integer

Public Propertye number() as integer
      Return _number
........

end Property

This code is built up in a string builder from a form where the developer has put in what they want to be as part of a class.

Then the developer says ok and at the moment all the code is written to a class file  that the developer has already created. What I am looking for is the code iwhich I can use to add the class file in and then write the output i have in the string builder. In other words so the developer does not have to add the class file

regards

END Class
0
 
LVL 11

Expert Comment

by:melmers
ID: 17864854
So that i understand you right, you need an example for write your stingbuilder content into an existing file. Should all content of the old class file be
overwritten ? In which environment runs your addin VS2003 or VS2005 ?
0
 
LVL 1

Author Comment

by:davoman
ID: 17864868
its 2005

no sorr,y all i need is to be able to create the .vb file (I can do it fine with an eisting file)

"Then the developer says ok and at the moment all the code is written to a class file  that the developer has already created. "

I simply need to know how to create the physical .vb file in code so i then can write to it

regards
0
 
LVL 11

Accepted Solution

by:
melmers earned 500 total points
ID: 17864906
       So here is an Example with an StreamWriter and a Textbuilder.

        Dim myNewSB As New System.Text.StringBuilder
        myNewSB.AppendLine("Test")
        myNewSB.AppendLine("Write to File")
        Dim myWriterStream As New System.IO.FileStream("c:\Test.vb", IO.FileMode.Create)
        Dim myTextWriter As New System.IO.StreamWriter(myWriterStream)
        myTextWriter.Write(myNewSB.ToString)
        myTextWriter.Close()
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
update textboxes with Streamreader 21 47
Allow User To Arrange Columns At Datagridview 3 26
Help with Syntax 9 37
Show/Hide ASP.NET controls with JQuery best practices 3 48
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question