|
Step by step:
In VC++:
1. File > New Project > VC++ > CLR > Class Library
2. Right Click on the project > Add > Class
Select Windows Form
3. Close Solution
In VB:
1. File > New Project > VB > Windows > Windows Application
2. Switch the Form IsMdiContainer property to true
3. Add a MenuStrip to the Form
4. Insert 2 menuitem:
-New VC++ Form
-Window
5. Select the MenuStrip
Set the MdiWindowListItem to WindowToolStripMenuItem
6. In the Solution Explorer right click on the project and Add Referece
Go to the Browse tab and find the VC++ dll
7. In 'New VC++ Form' menuitem click event:
Dim CppForm As Object
CppForm = New VCpp_Form.Form1
CppForm.MdiParent = Me
CppForm.Show()
Other notes:
-It works vice versa. (VB -> VC++)
-It is also possible to port the .NET window to other Dev. Environment,
but if you leave the .NET Framework it is more complicated than the specific example.
Such as I embedded the VC++ Form to the C++ Builder 6, but I'm absolutely sure it works with MFC, VB 6, etc.
|
|
|
|
|
Hi All
I have written an xml web service it works fine. My install program also works fine. The problem is that when I try and "edit" the web.config file I do not have the correct security settings on the web.config file. If I change them manually it the program works fine. Now the question. How do I go about setting security settings programmatically in .Net 2
Thanx
|
|
|
|
|
progamatically call WindowActivate event
how can i call it? thats of word object
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Goal:
Create a .NET Form in Visual Studio 2005 (C++) and use it in Borland C++ Builder 6 as MDI Child form.
I read several article in .NET Interop, and I managed to create the .NET form in Builder, but I have not any idea how to resolve the MDI childe problem.
Present source code avialable here:
http://bmfnik.hu/szokeimre/prog/DotNet_COM_Builder.ZIP
|
|
|
|
|
I resolved the MDI child problem too.
The key is WinAPI
|
|
|
|
|
Hi,
Iam new to the web applications,Can u Plz tell me whats the need of creating virtual directory for the web application
Advanced Thanks
Srilakshmi
|
|
|
|
|
you have required for create Virtual Directory IIS in your Operating System
then go ==> Control Panel ==> Administrative Tools ==> Internet Information Services
then go "web sites" ==> "Default Web Site"
Right Click on the "Default Web Site" and click on NEW => Virtual Directory
then Next gives name for VDs = Alias = Web project path = Read/write OR MORE = NEXT = FINISH
Pavan Pareta
|
|
|
|
|
Could u plz explain me what purpose we are creating the virtual directory,even without having virtual directory we can run asp.net web application in local system
|
|
|
|
|
You're talking about 2 different animals. IIS vs Casini.
|
|
|
|
|
has someone a simple sample in vb.net cf for a today plug-in. have only found a sample in c#: http://www.microsoft.com/downloads/details.aspx?familyid=5a37056b-a2b7-4968-89cb-5f7c3da1edaa&displaylang=en
but this today screen sample is very complicated for me, c# is not my language.
please, i hope someone can help.
mfg.
|
|
|
|
|
The environment is Visual Studio 2005 and my project was created via extensibility -> shared add-in.
How can I debug efficiently?
At present, I have to SETUP the add-in and start outlook manually each time I want to see the differences I have made to the program ...
-- modified at 14:35 Wednesday 25th October, 2006
|
|
|
|
|
imports microsoft.office.core.commandbar
which dll should i import??
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hi guys ,,
can u plz help me , i want to pass parameters to a function which is being called by a thread ,, i cannot find any solution to resolve this issue
void show(int a)
{
//process
}
t = new thread(new threadstart(show(90).start));
this code is not valid but u can understand what i want to do , have u any idea plz help me out
thans in advance
hello
|
|
|
|
|
You cannot pass parameters to thread methods in .NET 1.1. There are several workarounds to solve these issues, the one we follow is
<br />
class MyClass<br />
{<br />
private int a;<br />
public int A<br />
{<br />
get{ return a;}<br />
set{a = value;}<br />
} <br />
void show()<br />
{<br />
}<br />
}<br />
<br />
MyClass myObj = new MyClass<br />
myObj.A = 90;<br />
Thread t = new Thread(new ThreadStart(myObj.show));<br />
t.Start();<br />
In .NET 2.0, we have a ParameterizedThreadStart delegate which will allow you to pass parameters to the methods while creating threads.
My small attempt...
|
|
|
|
|
Question - How can the profile provider be specified at runtime?
Explanation:
I have two systems, one for 'Test' and one for 'Live' and each has a Sql Server.
When 'Test' code is published to 'Live' I currently have to edit connection strings in web.config to ensure that the live system does not access the test database and vice versa.
This method is prone to error so for Membership and Roles, I have created providers for Test and Live and select the correct provider at runtime. (This is achieved by recognising the machine name of the Test server).
eg
MembershipProvider myMembershipProvider =
Membership.Providers["CustomAspNetSqlMembershipProvider"];
MembershipUser myMember = myMembershipProvider.GetUser(strUsername, true);
However, the same syntax does not seem to be available for Profile.
I need to select the profile provider at runtime, but the defaultProvider is always used.
Extract from Web.config
<profile enabled="true" defaultprovider="CustomAspNetSqlProfileProvider" automaticsaveenabled="true">
<providers>
<clear>
<add name="CustomAspNetSqlProfileProvider" connectionstringname="LiveSqlServer" applicationname="myApp"
="" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<add name="LocalAspNetSqlProfileProvider" connectionstringname="LocalSqlServer" applicationname="myApp"
="" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<properties>
<add name="Firstname">
<add name="Lastname">
<add name="Comments">
The following code creates a ProfileCommon using the default provider
ProfileCommon mProfile = new ProfileCommon();
mProfile.Initialize("myUsername", true);
I would like to use the LocalAspNetSqlProfileProvider on the 'Test' system, and use the CustomAspNetSqlProfileProvider on the 'Live' system.
The following line fails because the 'Live' SQLServer is unavailable from 'Test'
TextBox1.Text = mProfile.Firstname;
How can the profile provider be specified at runtime?
|
|
|
|
|
Oops - I didn't realise that xml tags would be stripped. Here's the web config again.
Extract from Web.config
<profile enabled="true" defaultProvider="CustomAspNetSqlProfileProvider" automaticSaveEnabled="true">
<providers>
<clear />
<add name="CustomAspNetSqlProfileProvider" connectionStringName="LiveSqlServer" applicationName="myApp"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="LocalAspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="myApp"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
<properties>
<add name="Firstname"/>
<add name="Lastname"/>
<add name="Comments"/>
</properties>
</profile>
|
|
|
|
|
Hi
Can we use a dll file of .net in vb project or can we use a vb file in .net project. if yes how can we do that.
Thanks & Regards
Mishra
|
|
|
|
|
Only if built as COM objects.
|
|
|
|
|
|
thread s;
public Form1()
{
s= new Thread (new ThreadStart (ms));
InitializeComponent();
}
form _load
{
s.start();
}
void ms()
{
messagebox ("startes");
}
but the problem is thread messagebox is hosed only once , but i want to keep
it showing again and again untill the thread is started
can u tell me where i am wrong
hello
|
|
|
|
|
ReaderWriterLock readerWriter = new ReaderWriterLock( );
bool threadStarted=false;
public Form1()
{
s= new Thread (new ThreadStart (ms));
InitializeComponent();
}
form _load
{
s.start();
while(!threadStarted)
{
messagebox ("startes");
}
}
void ms()
{
readerWriter.AcquireWriterLock(1000);
try
{
threadStarted=true;
/// Thread code
}
finally
{
readerWriter.ReleaseWriterLock( );
}
}
|
|
|
|
|
hi
i have a comm device which reads data via a card reader ,,
it has an interface created in vb6 with a dll named "comm.dll"
there is a method named opencomm in this dll
when i call this method from vb code the comm opens and device works fine means it showd that it is not connected with computer comm port,,
but when i do the same thing in the c#.net , and open the comm using serial port object ,, it does not connect with the device altough comm open successfully ...
please help me out
thanks in advance
hello
|
|
|
|
|
"A call to PInvoke function 'CSharpDoorMagic!CSharpDoorMagic.Form1::OpenCommPort' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. "
whats this error about and why it is showed?
thanks in advance
hello
|
|
|
|
|
IT means you're using p/invoke, and signature is wrong, I would have said...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Most likely the unmanaged code is __cdecl but the P/Invoke declaration had CallingConvention=CallingConvention.Winapi (which is the default), which maps to CallingConvention.Stdcall on x86.
Windows on x86 has a number of calling conventions which define how parameters are passed to a called function, and whose responsibility it is to clean up. The __cdecl calling convention is the default for C and C++, where the calling function pushes the parameters onto the stack from right to left (last parameter first, so the first parameter is on top of the stack), and the calling function is also responsible for removing them again. This aids in implementation of functions with variable argument lists (similar to params in C#) since the first argument is always in the same place, and the called function doesn't need to know how many arguments were pushed.
The OS uses the __stdcall calling convention on x86, originally to save a little code space. This convention pushes the arguments in the same way as __cdecl , but now the called function is responsible for removing the arguments from the stack.
Because this is such a common mistake, the CLR contains code to detect, after making a P/Invoke call and doing any required adjustments, that the stack pointer is what it was before the function was called. It doesn't correct the problem because there could be other reasons for an unbalanced stack.
The problem goes away on mobile devices and 64-bit operating systems, where there is only one calling convention.
To correct it, you probably need to set CallingConvention=CallingConvention.Cdecl on your [DllImport] attribute. If in VB and using a Declare statement, you'll have to convert to using the DllImport attribute.
|
|
|
|