|
I'm kind of new to CLI but does anyone know why this won't compile?
#include "stdafx.h"
using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;
int _tmain()
{
SqlConnection ^myConn = gcnew SqlConnection("valid connection string");
myConn->Open();
if(myConn->State == ConnectionState::Open)
myConn->Close();
}
Its the default .NET console wizard in 2005 Express. I get errors a lot like this: error C3624: 'System::EnterpriseServices::ITransaction': the compiler cannot find this type;
it is defined in the assembly 'System.EnterpriseServices' (with various namespaces). Doesn't make any sense to me.
Matt Newman
...armed with what? spitballs!? - Zell Miller
|
|
|
|
|
|
Didn't know you had to add references like that, I guess C# does that automagically.
Matt Newman
...armed with what? spitballs!? - Zell Miller
|
|
|
|
|
I am using Visual Studio.Net 2003
My mainThread creates a newThread and the newThread starts doing its thing. At some point the newThread suspends itself; at which point it enters the ThreadState of Suspended.
I am trying to abort the newTread from my mainThread. When i attempt this using a newThread->abort();
It throws a ThreadStateException, i beleive because the newThread is suspended.
At this point the ThreadState of newThread is (SuspendRequested, AbortRequested).
So in the ThreadStateException catch, i use a newThread->Resume();
This causes the threadState of newThread to be simply (AbortRequested).
The problem is that I can't figure out how to get the newThread to leave AbortRequested state and enter the Stopped state.
If I call the abort from within newThread, it enters the Stopped state without problem; why can't I abort the newThread from within mainThread?
any help would be appreciated,
Thanks,
Jody Blau
|
|
|
|
|
You know how you can do the GetMessage() loop in Win32 programs? Is there any way to get the same thing in a c++ .NET app?
|
|
|
|
|
hey there,
Is there any way to create a simple client/server program in a 16 bit (dos)
project?
I can only use this kind of mode (dos 16 bit) because the microchip i am trying to control remotely connected to the server only supports borland 5.02 DOS 16 BIT projects.
thank you for helping and any suggestions are heart-warmingly welcome!
porac69
|
|
|
|
|
I have a dll written using VC++ 6. I cannot change it. But, I need to use it in C#. I am trying to write a wrapper in MC++ and then access it.
This is what I am trying.
In C#
------
static void Main()
{
try
{
F6xBscWrap f6bscW;
f6bscW = new F6xBscWrap();
//f6bscW.Reset();
}
catch(Exception e)
{
string s = e.StackTrace.ToString();
}
Application.Run(new Form1());
}
----
F6xBscWrap is the wrapper written in Managed C++. But as soon as the constructor is called it gives me a
An unhandled exception of type 'System.StackOverflowException' occurred in wrapf6com.dll
and crashes.
The managed wrapper for the constructor is
----
F6xBscWrap::F6xBscWrap()
{
try
{
f6bsc = new F6XBasicCfg();
}
catch(System::StackOverflowException *e)
{
Object *s = e->StackTrace;
}
}
----
and the wrapper .h file is
----
public __gc class F6xBscWrap
{
private:
F6XBasicCfg __nogc* f6bsc;
public:
F6xBscWrap();
~F6xBscWrap();
void Reset(); // Reset to zero
};
----
Any and all help will be appreciated.
|
|
|
|
|
I need to add hotkeys to buttons on a form
e.g F2-F12
How to do that?
tia,
kriss
Gupta Team Developer 3.1
VC++ 2003
Oracle 8i
W2K-XP
|
|
|
|
|
forget it, i put in a MainMenu and add the quickies there.
Where the menues are for buttons only, i simply hide them.
thanks, ;);P (( Kriss
Gupta Team Developer 3.1
VC++ 2003
Oracle 8i
W2K-XP
|
|
|
|
|
I am currently having trouble in writing a permutation in lex order the function i am working bellow is needing to do this:
//return position of the smallest number between index start+1
//and size (inclusive) that is greater than v[start]
It however i dont believe works correctly. Can any one help me.
v is a vector that contains: abcd
i = the first value to the L < R
size is the v.size()
//call of function
giveMePositiontoSwap(v, i, size);
//function
int giveMePositiontoSwap(vector<valuetype> &v, int start, int size)
{
int smValue = size-1;
for(int i=start+1; i < size-1; i++)
{
//finds a value greater than v[start]
if(v[i] > v[start])
{
//finds smallest value within the index start+1 and size
if(v[i] < v[smValue])
smValue = i;
}
sortItems(v, i+1, size);
}
return smValue;
|
|
|
|
|
I've been programming via V6 and MFC for a number
of years; but I'm a newbee with C++ .Net (2003).
I have been using STL's vector and map as my common
containers. Now am reading books on Managed C++ and
Forms. There I read of the Managed C++ .NET container
set.
My questions:
-- Are the Managed C++ .NET containers any more
(or less) efficient than SLT containers?
-- I understand STL containers. Is there any
advantage to move to Managed C++ .NET containers?
-- I would like a second opinion on strong advice
that I advance my knowledge of templates, read
"Modern C++ Design", plus several others recommended.
(I understand I have fallen behind in my knowledge
of the templates; but I'm not sure I really need to
keep up.)
WedgeSoft
|
|
|
|
|
They are less efficient and do not offer the functionality that STL gives you.
John
|
|
|
|
|
hi i am an engineering student and really interested in programming.. i want to develop a c or c++ program(not visual c++) . my iodea goes like this .. suppose somebody runs th .exe file . then suddenly a notepad opens and some text starts gettin written on it ........... similraly some sound also starts playin ...... i know how to open notepad or winamp but i really dont know how to play songs or write text through c......... if anybody could really help me then i will be really grateful..... this program is just for fun purpose............
|
|
|
|
|
So you don't want to use Visual C++, but you're posting in the Managed C++ forum ?
Your program sounds like a nuisance to me.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
I have a form (name MyForm), where I want to know when the Arrow keys pressed
so I made this function but its not working for the arrow keys.
Its working great for all the others (shift, alt, caplock.....)
dont know what to do please help
in the constructor:
this->add_KeyDown(new KeyEventHandler(this, &MyForm::KeyDown));
the function:
void MyForm::KeyDown(Object *sender, KeyEventArgs *e)
{
switch(e->KeyCode)
{
case Keys::Down:
MessageBox::Show("Key Down was pressed");
s->Down(picGame->Handle);
}
}
I tried to step with the debugger, nothing happens when I press arrow keys
Its not getting in to the function
for all other keys it does.
|
|
|
|
|
Hai,
I just copied your code and its works!!!!
Sometimes the focus is not on your Form .
|
|
|
|
|
Youre right.
I tried it with an empty form and it worked.
I have on my form only a picturebox and a button, how can I keep the forms focus always.
I never need the focus on the other controls.
thanks.
|
|
|
|
|
hai,
Sorry i dont know how it solve!!!
Some where i found to override the ProcessmdKey method
but i didn't get too much ideas
If u solve the problem plz post it
by
ANish
|
|
|
|
|
Thanks
I will post if there will be any soloution.
Yuval
|
|
|
|
|
Can anyone help me?
I am getting this error..
h:\169\program 3\ManageData.cpp(62): error C2782: 'int ManageData::searchArray(T [],int,T)' : template parameter 'T' is ambiguous
with this call statement..
index = searchArray(studentArr, numStudents, entry );
that calls this function...
template<typename T><br />
int searchArray(T arr[], int size, T target)
grrrrrr, I can't get rid of this stupid error! ![Mad | :mad:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_mad.gif)
|
|
|
|
|
For about a week now i have been reading and reading but still can not make any sense about strings in C++ .Net.
Problem 1 is comparing strings, for example:
String* Str1 = "HELLO";
if (Str1 == "HELLO") // Also Tried using Compareto
{
TextBox1 -> Text = "Same";
Else
TextBox1 -> Text = "Not The Same"";
}
I have even put in breaks just to make sure that the strings are the same - which they are.
Problem 2, does left, right, mid still exsist?
Thanks,
Dave
|
|
|
|
|
You are comparing two objects not strings! This will work:
String* Str1 = S"Hello";
if (Str1->CompareTo(S"Hello") == 0)
...
However, the following will seem to work but you are actually comparing the same object to itself:
String* Str1 = S"Hello";
if (Str1 == S"Hello")
...
Str1 is actually pointing to S"Hello". S"Hello" really a String object.
S"Hello" actually means new String("Hello");
Thus S"Hello" or (Str1) does not equal the literal string "Hello" (without the S prefix).
Also, use the String object's method "SubString", for Left, Right and Mid.
|
|
|
|
|
Hai,
You can comapre the Strings using the static Compare method in the String class
ie
String* str=S"HELLO";
if(String::Compare(str,"HELLO")==0) //ie Same
{
TextBox1 -> Text = "Same";
}
else
{
TextBox1 -> Text = "Not The Same"";
}
SubString function done all the left, right and mid functionalities
by
Anish
|
|
|
|
|
One more little thought to add to the above:
You can not change a String object. Replace
only deletes the old and creates a new object.
Once created the String is fixed. So -- if in
a loop changing a sting; be careful of using
String.
WedgeSoft
|
|
|
|