Using textbox defined in one project to another project - c#

Is there anyway to access the textboxes defined in one project to the other project using c#
Thanks for suggestion

Yes, you can do that with native win32 api calls.
See this question:
C#, Get other application text from TextBox and TextArea?

Related

ASP.NET Web Application Project only shows VB options, not C#

I'm working on a project and I'm fairly new to ASP (not to C#).
We have a solution for a whole web application consisting of several projects and I want to add a couple of ASP WebForms to one of the projects. However, when I right click on the folder of the project and select Add element, it only shows me VB options.
But if I try to add other project to the solution, then all the other options are displayed.
The project in which I'm trying to add new Web Forms is entirely written in C#, so I don't know well what's happening back there. I cannot stop thinking it might a dumb mistake I'm making.
I'm working under Visual Studio 2017 and .NET Framework 4.7.2. It is there some kind of requirement I'm missing?
Thanks in advance for your time and sorry if it's something simpler, but I really don't know what's going on here.
As noted, this looks like that one application was created as a vb.net application.
You can freely consume say c# code (assemblies) in a vb.net project. And of course you can do the reverse.
However, for a given project created? You can't at the IDE level mix vb.net and c# code modules and general writing of code between c# and vb.net.
However, as in your example, you can certainly "include" multiple mixes of vb.net and c# projects into one same project. However, each part and section will still be limited to the chosen language used to build that application. So mixing is allowed at the project level - but not below that level.
So, it looks to be that project was created and developed with vb.net. You can't really change that unless you create a new project as c#, and then pull in all the forms, code etc. and re-factor the vb.net to c#.
So your practical project language choice is really limited to the project level. Multiple projects of different languages can be included overall, but each part will remain in its given language choice. The fact that you can do this in .net is amazing enough, but that language choice is really set in stone at the project level.
While you're figuring it out, if you need to press on and get some work done just copypaste another file that is already in the solution, and is of the type you require, then change its contents. This can usually be a time saver anyway, as the "new product" form isn't so hugely different from the "new user" form, just a different bunch of labels and textboxes..
There is nothing magical about the "add new item" dialog, it just adds files with pre filled templated content. For a cs class (for example) that's a file that basically has a detected namespace and the name you specified in the add dialog. You could even add a VB file of the type you want and then change the contents and name of the file to be right for C# - it would essentially be adding a couple of curly brackets and changing the case of Namespace and Class (and maybe changing Imports to using)
You cannot mix languages in the same assembly in .Net. Create another assembly you can put your C# code in there and use it in the VB.Net project.
Or use VB.Net it's not that bad.

There is no Default.aspx.cs file into my webapplications project

Before telling you anything i'd like to clear, I'm a completely beginner in ASP.NET. In fact, I started learning today ASP.NET.
So, I'm making an event that would bind my code with C# files. Well I'm good in C#.
But the problem is as I find into projects, there is no Default or any aspx.cs files here. Can you please help? Where can I find it?
This tutorial says that to bind events, you need to write code in .cs files.
Here is my how my project is setup:
I think you have choosen a wrong project type while creating your project.For your purpose you need to do following
File>New>Project
On the left panel Go Visual C# > Web
Select ASP.NET Web Forms Application
Looking at your screenshot it seems you selected "ASP.NET Empty Web Application".You can add files to this as well but since you are a beginner its better to follow above steps.

How do I get the current Project Template Name?

I have DTE.Project object - How do I get from there the Project Template Name?
I'm trying to detect the project template so I would be able to later on recreate it programmatically. if I have the name i can do it. Is that the right way to go?
I've already seen http://www.mztools.com/articles/2007/mz2007016.aspx, but not all projects have "projectTypeGuids", for example, Windows Forms Application and Console Application, and ProjectType and OutputType properties doesn't help me because they are the same for the aforementioned templates.
Thanks.
The answer could be found here: (it's hebrew)
http://blogs.microsoft.co.il/blogs/shlomo/archive/2012/10/10/how-do-i-get-the-current-project-template.aspx

How do I convert a windows forms app from C# to VB?

I've been converting all kinds of other things, classes, interfaces, ASP.NET MVC apps, and WPF applications, but I am stumped as to how to convert a windows forms application, as the whole structure seems to be different. Does anyone have any advice on how to tackle this problem?
I see essentially that you have two files, Form1.cs and Form1.Designer.cs. Literally translating them from C# to VB doesn't work because of some intricacies or other of how Visual Basic works. I think you /might/ be able to convert Form1.cs in this way, as it's just a constructor plus event handlers, but the designer contains the references to the controls etc. and I am not sure how to go about doing that.
I am using Visual Studio 2010 Beta 2.
My approach would be to create a new form in VB do add some forms and add events and look at the VB generated from there you will be able to see how each element [control/event/propertyset] is done in both C# and VB. From there it should be trival to conver from c# to VB.net. This would give me more confidance the designer could cope with the converted class as well as the runtime.
What I did is to manually create a new form in VB with the same name as the form in C#, then opened the C# form in design view, made sure that I selected all controls on the form, copied and pasted them onto the empty new form in VB. Then just translated the code-behind with the telerik free converter at:converter.telerik.com. I'm sure it becomes cumbersome if you have a huge solution that you need to convert, but in my case it was a small solution and the results were great.
Redgate.NET Reflector does a great job.
The two files each contain a part of the Form1 class, in the form of partial classes. As partial classes are also supported in VB.Net, I don't see a problem here.
The designer file contains all of the code generated by the windows forms designer, the Form1.cs file is the place where all custom code goes (event handling, etc).
So after converting both files you should check if all references made to controls in the Forms1.cs file are available in the designer.cs file.

C# asp.net Howto load an aspx page from another project?

I have 2 projects. One project is a core and contains the GUI which is always the same and acts like a kind of framework.
The second project is an application that must be set in the framework.
The framework consists of a masterpage and a content page (application.aspx). From my second project I want to load the application.aspx. Is this possible? And if so.. how?
We did very similar thing in our projects
We add the folder/files in our source safe, and share these folders/files to other projects from source safe
Server.Transfer("application.aspx");
will take you there. What do you mean by
load the application.aspx?

Categories

Resources