Namespaces - Including Common Code In Multiple Files?
Jun 19, 2012
I'm new to the .NET platform (old-time ASPer) and for a project have a simple pair of .aspx scripts that take some querystring data and process it. They both make use of the same Subs, Functions in them, so naturally I'd like to move the code to a common resource.vb file. Having done some reading, it looks like my options are a Code-Behind type setup, and placing the Subs, Functions in a .vb file and placing that file in App_Code.So, the Code-Behind model doesn't seem to make sense here, as the functions are shared by both files. Placing the Subs and Functions in /App_Code/resources.vb and I am getting the following error when trying to call any of the routines:
View 2 Replies
ADVERTISEMENT
Jan 22, 2012
Wondering if it is possible. It works on the idea that all files share common code. The program would ideally analyse the source file and compare it to the reference files. It would then find common parts of the code and write it to a rebuild file. At the end the rebuild file and the reference files would then be able to rebuild the source file without it being present.
For Example.
source file code = xxyyzyzyxw
ref file 1 = xyxxzyzxwyy
ref file 2 = zxxwyzzywxx
The program would then analyse these files and make a rebuild file like the following
source(0,1) = ref1(2,3)
source(2,3) = ref1(10,11)
source(4,7) = ref2(5,6) + ref2(5,6)
source(8,9) = ref2(2,3)
Thus you would be able to build the source file using these instructions and the reference files.
View 1 Replies
Sep 27, 2010
Is it possible to have a single class reside within two name-spaces and how can I do this?
To clarify: We have a class library (let say root namespace is classLib1), which has grown over time (more classes) and I want to logically group classes into different namespaces. However some of the older classes need to be grouped into these new namespaces (e.g classLib1.section1) and doing so will break legacy code in other assemblys that use this class library. So I want to be able to refer to a class using both name-spaces until we can phase the old ones out.
I can't find any information on this, which suggests there is a reason that people would not want to do this!?!
View 3 Replies
Jun 9, 2011
How to list all files in a folder including subfolder files.
View 9 Replies
Aug 17, 2010
i have this right now:
ListBox1.Items.Clear()
Dim di As New IO.DirectoryInfo(TextBox1.Text)
Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")[code]......
and that displays only the file name, like text.txt but i want it to display C:/Text.txt and all the files in the subfolders too, like C:/Program Files/Test2.txt but i just get test.txt from only the c:/ .
View 2 Replies
Jun 9, 2011
I have the file xmlcontents.xml with the following content[code]....
View 4 Replies
Jan 19, 2009
For a project I am working on there are two namespaces. Currently,[code]...
The problem is that when I have the button click inside the ScreenCapture Namespace, it gives me an error with the Handles Button1.Click saying " Handles clause requires a With Events Variable defined in the containing type or one of its base types". If I move it out of the namespace however, it tells me that Function1 is not defined.
View 2 Replies
Nov 5, 2010
I have this code so I was wondering how do you put in multiple files: E.g:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If System.IO.File.Exists("C:fileiwannadelete") Then
My.Computer.FileSystem.DeleteFile("C:fileiwannadelete")
End If
End Sub
View 1 Replies
Feb 5, 2010
I am trying to create a program that can upload many files at a time to an FTP site. I don't want to use a dialog box. I want to be able to specify a certain requirement in my code (for ex. all files that begin with "abc_"). I was able to find a lot of code online for uploading a single file, but all the code that I found for mulitiple files were either very lengthy or done by bringing in a new library
View 1 Replies
Jun 28, 2011
There are 3 project in vb.net MAIN PROJECT, BLL(Business Logic Layer), DAL(Data Access Layer) now we are trying to maintain one single instance of some values through out the assembly or what we can called single instance should get used in all projects...for example there is a class called clsParameter we need only one instance of this class should get used through out all projects so if i made any change in MAIN PROJECT same values also get updated in BLL or BLL should receive same values....
View 3 Replies
Jul 26, 2011
I want to be able to incorporate some constant definitions and enum types in multiple classes of mine.Something akin to including a header file in C++. How do I do this best in VB.NET? I'm having a hard time because the only way I can see to do it is to inherit a class with the definitions in it but there is no multiple inheritance in vb.net so I am having some issues with that.
View 6 Replies
Jun 6, 2012
I have a vb.net project that has 2 exe's that get built as well as the installer. The two exe's share a bunch of common files. I do not want to have two copies of the common files or mess around with having build events that copy things around (if possible).My method was to create two projects in the same folder and have them point to the files they needed.This appeared to work until I tried to compile both apps at which point I get an error in a file called Application.Designer.vb. It seems that project files create this file in their folder and when I have two solutions in the same folder they conflict.
View 8 Replies
Dec 10, 2010
Is there anywhere I can add folders to my project, so when someone downloads my project/program they automatically get the files I added into it. Say I want to include a data file, and my program automatically uses that file for my RichTextBox1 - And everytime they save, it saves to that file - And when they open up the program again, it opens that automatically preloaded file that came with the program?
View 1 Replies
Jun 28, 2009
faster way to enumerate through a directory and sub-folders to gather all the files in the enumeration? This is what I have right now:
Public Shared allFiles() As String
allFiles = Directory.GetFiles(<ServerLocation>, "*.*", SearchOption.AllDirectories)
EDIT: I am enumerating these files from a server location. I don't know if that will change the perspective of this question or not.
View 4 Replies
Feb 19, 2009
I've tried searching for a way to get a list of all files + all files in all subdirs. I've tried a simple shell("dir /s /b > myfile.txt") but it doesn't work because of some Danish specific characters. I have looked at the "getfiles" method, but I can't get it to work
View 4 Replies
Jun 22, 2010
I'm writing a program that gathers a list of files within a directory and optionally, every file within the subdirectories (10 levels deep) of the directory then exports it as a text file. I have no idea how to do this so I just attempted to code it myself.
It works by gathering a list of every subdirectory within the selected directory and their subdirectories, so on and so on and adds them to a listbox. Then to gather the list of files I used a for each to get the files within the subdirectories but it shows "(Collection)". After exporting it shows " System.Collections.ObjectModel.ReadOnlyCollection`1[System.String]".
How can I make this code work? I think I could've done this much easier a different way but I need the full path included.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
ListBox1.Items.Clear()
Dim FolderBrowserDialog1 As New FolderBrowserDialog
[code]....
View 1 Replies
Jan 3, 2011
I have written a simple app that allows our clients to access documents they might need throughout their time of doing business with us. They access these document via a button click event. First off I'd like to publish this program and install it onto a CD so that the end user does not have to install anything on their machine. They just simply pop the CD in and the program runs and they can click on whatever document they need. I'm having to trouble figuring out how to install it on a CD. I am also pretty sure i've done my mouse click events incorrectly because i have the exact path to the documents in my resources file.
i'm currently using the "System.dianogistics...process"(i'm not sure if thats the exact syntax and i forgot a couple of the words) function(i'm not sure if this is a function or not. i'm not super familar with VB). but when i use this method it requires the exact path for the file. which doesn't make sense if i want it on a CD which would change the location of the file for my C: to E:.
View 1 Replies
Apr 22, 2012
I am trying to create a sort of code library in visual basic where the form displays a list box of certain project files in vb that i have made in the past and when clicked, launches the .exe files of those visual basic program project files.I know it does not work the same way as writing/ reading text files to vb and it seems as simple as 'on click, launch .exe of selected string "vb program 1" and so on. I am having trouble getting started on this one. Im sorry I cannot provide any starter code bc I only have a basic understanding of in/out text files which wont work the same way with .exe
View 1 Replies
Jan 31, 2009
I have data entries in my database that have a common field. For example:
account_id type user_id
1 new 1
2 old 3
3 new 1
4 old 1
I am using a query like this(mysql): SELECT account_id, type, user_id FROM table WHERE user_id = 1
This is just all theoretical. The problem that I am having with this is it is only returning the first result in this case account_id 1. How can I get it to find all the results with the user_id 1 because in the way I am thinking that it is failing is that it is finding only the first result and then ending?
View 1 Replies
Dec 1, 2009
I am writing an application where data can be gathered from many different places and graphed against other data. However the data from all the different places is coming in different formats such as .csv, .txt and some others i can't recall right now.So i am wondering what is the easiest way to allow my program to import the data supplied in these different formats?
View 4 Replies
May 13, 2010
I've got a VB.net application. Currently the release version of the application is produced without a PDB file. This gives me error logs lacking useful details such as line numbers. I'm looking at including the PDB files with future builds but i'd like to know what the advantages and disadvantages of this are (performance wise, size wise, code security wise)
View 4 Replies
Apr 19, 2012
I am trying to write an application to delete files in a temp directory - so for example C:WindowsTemp
I need it to delete all files and subfolders (including all files in these subfolders) - but to NOT delete the top/root folder i.e. in this case Temp
I have tried
Dim fso, fldr
Set fso = CreateObject("Scripting.FilesystemObject")
Set fldr = fso.GetFolder("c:windows emp")
[Code].....
View 9 Replies
Jan 30, 2007
i have a vb script that is imbeded in an html page (hta). when i use the common dialog flags = cdlOFNAllowMultiselect the file list is present in the filename object and are separated by a space. however when i use dialog flags = cdlOFNAllowMultiselect Or cdlOFNExplorer the files that i selected on the dialog box, are not present in the filename object. the only thing that's there, is the path to the files. here's the code:
Const cdlOFNAllowMultiselect = 512Const cdlOFNExplorer = 524288Set ObjFSO = CreateObject("UserAccounts.CommonDialog")ObjFSO.Filter = "All Files|*.*"ObjFSO.FilterIndex = 1
ObjFSO.InitialDir = "c:" ObjFSO.Flags = cdlOFNAllowMultiselect or cdlOFNExplorerinitFSO = ObjFSO.ShowOpen selected_files = ObjFso.FileName msgbox selected_files
how can i get the files names?
View 2 Replies
Apr 12, 2010
I've inherited a project in VB6.NET 2008. There is a Panel control where graphs are drawn along with titles, axes, legends etc. What is drawn on the panel is also printed WYSIWYG (on a print command, of course) The problem I have is that the code for printing is entirely separate to the code for drawing. I want to merge the two so that common code is used. I'd like to work in the same units for both, which means setting either the pixels per inch for the Graphics object for the printing (so I can work in pixels) or doing the equivalent of the opposite so I can work in inches (printed inches, not screen inches).
View 2 Replies
Jan 26, 2011
I'm a newbie in asp.net. When using FormView, there is a big amount of code in ItemTemplate, EditItemTemplate and InsertItemTemplate which is almost identical.
[Code]...
ListView allows the use of LayoutTemplate - but I didn't see any examples that insert this kind of code in LayoutTemplate. And inserting this code in LayoutTemplate would result in an error.DetailView allows to produce code automatically but I'd like to use a specific design (for ex. using "fieldset" that encompasses some fields).
View 1 Replies
Jan 22, 2009
Trying to start a discussion on what approaches forum members take when faced with the issue of writing code that calls SQL queries upon a DB. Do you tend to always put SQL in stored procedures and call the proc (and does that include basic CRUD operations) or always the opposite? Or do you prefer a mix of some procs and some coded sql? If its the latter then how do you determine which queries go where?I imagine the scale of a project can dictate some of the possible answers. I've done both and sometimes I find that quick and dirty apps that have little chance of changing or are easy to modify do not need procs. On the other hand, I generally will choose the mixed option where anything other than CRUD (i.e. workflows) will be sent to a proc. I have a particular interest in hearing about your experiences with larger projects (i.e. 100+ tables in the DB) that employ a Domain Model approach to a layered solution (has distinct UI, business, and data access layers.) However I'm interested in responses to all sizes and shapes of projects.Opinions?
View 1 Replies
Jun 28, 2010
I am trying to minimize my code writing. I have DBLayer base class that selects, inserts, updates and deletes records from database. I need only fieldlist and table name from each derived classes to perform the actions. I have defined static tablename, fieldnames in derived class. Currently I am defining next static functions in derived class for GeneralSelect [which selects all records], GeneralInsert[Which inserts a records], GeneralUpdate[Which updates records as per given id] and GeneralDelete[Which deletes a record of the given id]. The parameter and all functioning are same just the differece is the table name and fieldnames.
One DBLayer Class that performs database actions
Class DBLayer
Public shared function Query(byval SQL as string) as dataTable
[code]....
... same goes for all other table objects... If I have 20 database tables i have to write getdata method in all 20 class changing only the tablename so i would like to get ride of it. So in order to get ride of it what do i need to do?
View 1 Replies
Aug 21, 2010
I'm making a program that takes common applications and installs them silently using batch files. Someone would select the programs they would want to install and my program will write a giant batch file and execute it to install whatever they want. Heres the problem, After the user selects the programs they go into either one or two lists. Non Silent Installer List Or Silent installer list.
Some programs I have simply won't go silently so from there they can choose in what order they want to install these programs. Then there is a combo box that tells weather you want to install non silent programs first or last. From there you hit add to batch file and it would add everything in listbox1 and listbox2 in order. Listbox1 would contain just the text "MalwareBytes" for example. Along with Novell Groupwise and Firefox. How do I get that to add to the Batch List as a code and in order? So the user wants Malware bytes added first to the batch file. How do I add that to my batch list as a completely different code?
[CODE]..............
View 8 Replies
Apr 6, 2009
The VB application is automatically getting closed whenever the code is invoking any common dialoge control especially when the MS office Enterprise edition 2007 is installed.
View 1 Replies
Aug 10, 2009
how to Total Folders and including files from Windows explorer into listview using drag & drop method at vb.net
View 3 Replies