|
Hi, I am using Visual Studio 2005 C++/CLI. I was just curious about something. When I am 'using namespace System::Drawing' and I want to display some text on the screen I have the following two lines to setup my brush and font...
SolidBrush^ blackBrush = gcnew SolidBrush(Color::Black);
System::Drawing::Font^ myFont = gcnew System::Drawing::Font("Ariel", 16);
If I don't include System::Drawing:: in front of font, then this will not compile. If SolidBrush and Font are both classes in the System::Drawing namespace why do I have to include (for lack of a better term) the full path of the Font class? What makes the Font class different?
Thanks
Buck
|
|
|
|
|
Hi all,I am having some problems with the OpenEx functin,the probelm is I don't know how to formulate the connection string.I've been using:
CDatabase con;
con.Open(_T( "DSN=;UID=sa" ),CDatabase::openReadOnly |CDatabase::noOdbcDialog );
But where do we pass the server name and the password?The program haults with an exception,this is my first application using afxdb and CDatabase,thanks in advance.
|
|
|
|
|
First, you're in the wrong forum if you're not using Managed C++/CLI.
Connection strings vary, depending on the ODBC driver you're using, and are generally documented
somewhere.
For example, when using the SQL Native Client for SQL Server, there's:
Using Connection String Keywords with SQL Native Client[^]
Also, CDatabase and related classes use exceptions for error handling. You'll probably want to catch
those exceptions and at least examine them - they provide fairly detailed error info from the ODBC
driver.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am sorry,in my haste to post the question I posted it in the wrong form,I am using the .net frame work to create a visual C++ windows from application. I didn't want to use the sql adapter thing, i wanted to creat a connection the old fashioned way using cdatabase and afxdb.I am using sql server 2000 and thats what i want to connect to.Frankly I haven't had much time to research this at all,I was checking out this site and thought I might try it,I thank you all for your help and time.
|
|
|
|
|
CodeMaster_05 wrote: I am sorry,in my haste to post the question I posted it in the wrong form,
No problem! Everyone gets one chance...
Did you find the connection string info you needed? I used to have it for SQL Server 2000 but I
can't find it....I'll let you know if I do.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually, it looks like the link I posted applies to 2000 as well (when using the native client).
Make sure you scroll down to the ODBC section
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks alot,it works perfectly, you people are great. Best regards
|
|
|
|
|
Hi
I'm trying to let my application run another application and give it write permission. At the moment i'm using CreateProcess, but can't figure out how to grant the process write permissions..
Tried googling alot, but can't find too many examples.. =/
Can anyone help me..?
Thanks!
|
|
|
|
|
I want to read data from a hardware device like time access punching machine.
What is the complete process to read data and storing into a databse from any hardware device.
If any one have some idea, please guide me.
Thanks,
Pathak
|
|
|
|
|
pathak78 wrote: What is the complete process to read data and storing into a databse from any hardware device.
Like so? (Pseudocode)
do
Read the data from the hardware's interface
Append to your database
until exit
Failure is not an option - it's built right in.
|
|
|
|
|
Reference types(ref class/struct) only supports public inheritance.
ref class Base{};
ref class Derived1 : public Base{};
ref class Derived2 : private Base{}
ref class Derived3 : protected Base{}
Why C++/CLI doesn't support private and protected inheritance?
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Because it only supports what .NET supports.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
vibindia wrote: Why C++/CLI doesn't support private and protected inheritance?
I have a better question for you. What makes "so called software developers" think they can develop software using technology and tools that they don't know anything about because they have never read the freakin documentation?
|
|
|
|
|
I give up....what?
Sorry, I thought it was a riddle. Oh wait, it IS a riddle...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
i would use an array of string with every fields of this array was an other array of string, i try for
array < String ^ > ^ tab=gcnew array < String ^ > (200);
tab2 tab[20];
But unfortunatly there are error
Thank you verry mutch
|
|
|
|
|
Can you use a multidimensioned array?
array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
when i make this
array < String ^ > ^ subItems = gcnew array < String ^ >(16);<br />
<br />
array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);<br />
<br />
tab[i]=subItems;
there are arrors:
Error 185 error C2440: '=' : cannot convert from 'cli::array<type> ^' to 'System::String ^'
Error 184 error C3262: invalid array indexing: 1 dimension(s) specified for 2-dimensional 'cli::array<type,dimension> ^'
Thank you verry mutch
|
|
|
|
|
If a 2 dimension array works for you then all you need is
<br />
<code>array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200);<br />
<br /> That's 4000 Strings.
You can add a String something like:
<code>tab[0,0] = gcnew String("String at (0,0)");<br />
<br /> What are you trying to do with the other array?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would store subItems in any structure {because i have many subItems who are generate with a Timer} , then recover the contents of this structure after a few moments,
array < String ^ > ^ subItems = gcnew array < String ^ >(16);
Thank you verry mutch
|
|
|
|
|
So it's working now?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Unfortunately, it doesn't work yet
I would store subItems in any structure {because i have many subItems who are generate with a Timer} , then recover the contents of this structure after a few moments,
array < String ^ > ^ subItems = gcnew array < String ^ >(16);
and i would set : Structure [i]= subItems ; i++;
Thank you verry mutch
|
|
|
|
|
array < String ^ > ^ subItems = gcnew array < String ^ >(16);
// Structure is an array of string arrays
array < array < String ^ > ^ > ^Structure = gcnew array < array < String ^ > ^ >(numberofstringarrays);
Structure [i]= subItems ;
i++;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
These simple problems are begining to bug me. I'm using Visual Studio 2005 C++/CLI. My app does some stuff that takes long enough that I wanted to have a small dialog box appear with status information. In Visual Studio I select 'project'->Add New Item->UI->Windows Form and give it the name of "Status Dialog". This creates the "Status Dialog.h" header and the name of the class is 'ref class StatusDialog' (note no space between Status and Dialog). The "Status Dialog.h[Design] page appears with a new form. I add a label (that I plan to change progromatically) and that's it. I open the myClass.h file of the class I want to use it in and include the "Status Dialog.h" file. This all compiles fine. I add the declaration in the myClass.h file as StatusDialog^ aDlg;. This does not compile. It gives the general error of C2143: syntax error : missing ';' before '^'. The "Status Dialog.h" file is created by Visual Studio so it should be okay. Does anyone see anything wrong here. This should be simple.
#include "Status Dialog.h" // Created by Visual Studio
using namespace System;
ref class myClass
{
public:
myClass(void);
StatusDialog^ aDlg; // Remark this out, compiles OK. Leave in and I get the syntax error.
};
}
Buck
|
|
|
|
|
Is the StatusDialog class in the same namespace as the myClass class?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I believe so. The first line before "ref class StatusDialog" is "namespace projectname{". I looked at "Form1.h" and "Status Dialog.h" and they both have this namespace declaration but the myClass.h file does not. I added a "namespace projectname" to the myClass.h file but that did not help. I am going to try to remove the two namespace declarations in the Visual Studio generated files to see if that helps.
|
|
|
|