|
i am creating dataset. There is no previous connection. I need to create connection. if i click new connection button it is disappearing or escaping in visual studio 2008 windows appln.
What might be the problem. Please reply me.
Thanks in advance.
|
|
|
|
|
Your problem might be related to this
|
|
|
|
|
I created dataset in Visual Studio 2008 using database name payroll_system with payroll_systemconnectionstring (sql server 2005), now recently we changed the database name to only payroll. If i remove the dataset all the fields which i created in report will automatically goes because of this connection string removed.
How to change the payroll_systemconnectionstring to payrollconnectionstring (dataset) without removing the fields in reports.
If anybody knows, please reply me. Thanks in advance.
|
|
|
|
|
I am not a database expert but I would assume that you only need to change the name in your connection string. Your program's object names can remain as they were.
I must get a clever new signature for 2011.
|
|
|
|
|
The first question arises, why do you need to change payroll_systemconnectionstring to payrollconnectionstring? I think you can simply change databse string value for payroll_systemconnectionstring and use the same. You need not create a new 'payrollconnectionstring' and abondon 'payroll_systemconnectionstring'.
If you happen to do so, yes, you will have to overwrite 'payroll_systemconnectionstring' with 'payrollconnectionstring' everywhere in code.
|
|
|
|
|
With Microsoft Word, we can use templates to create documents, and "AutoTexts" to enter text more quickly. I was trying to find out how I could access those features via Interop from a C# application.
The Word.Application object has a property Templates . Also a Word.Document has a property AttachedTemplate .
When I do
Word.Application wordApp = new Word.Application();
the "Templates" does always contain exactly one template - that is Normal.dotm.
When I do
object missing = System.Reflection.Missing.Value;
Word.Application wordApp = new Word.Application();
Word.Document doc = wordApp.Documents.Add(missing, missing, missing, missing);
Template template = doc.get_AttachedTemplate();
template is also always Normal.dotm.
And the same holds true, when I do
Template template = wordApp.NormalTemplate;
Never did I get my other templates.
A Template has an AutoTextEntries property. I find only two entries: my initials and my full name. Never did I see my other AutoTexts.
A Google search was not successful, only lots of hits for opening Word with a template of known path. But I want to enumerate all existing templates, and then get my AutoTexts...
Some further information: on my Win7-64bit computer, Word 2007 is installed. The Interop.Word was generated with Word XP in order to stay compatible with our customers using older software.
Thanks a lot for your help,
Bernhard
|
|
|
|
|
Interop.Word can be such a pain! I am not familiar with the AutoText stuff you are talking about but I have two comments about your post...
1. Word documents by default use the Notmal.dotm template by default then they are created so that would make sense that a call to get_AttachedTemplate() on a new document would return the default template (thus matching .NormalTemplate)
2. In regards to the version of Interop.Word you are using, you will get backwards compatibility by using later versions. It is more the version of Word rather than the version of Windows that you need to cater for. I would recommend getting hold of an Office 2010 version of the Interop and that should span back to work with Office 2003 (if not earlier) - however, not sure if the 64bit Windows will cause an issue with getting this
Illogical thoughts make me ill
modified on Wednesday, February 16, 2011 10:22 AM
|
|
|
|
|
Maybe this can provide a clue? I cannot see the AutoTextEntries property you speak of thou...
foreach(Word.Template template in wordApp.Templates)
{
}
wordApp.Templates supposedly returns all available templates both gloabl and those attached to open documents
Edit:
AutoTextEntries property does not come up in Intellisense, but this does compile...
foreach(Word.Template template in wApp.Templates)
{
foreach(Word.AutoTextEntry entry in template.AutoTextEntries)
{
}
}
Illogical thoughts make me ill
modified on Wednesday, February 16, 2011 10:22 AM
|
|
|
|
|
Thanks for your replies (I had tried those things before I asked the question, and included that very condensed - perhaps too condensed - in my question).
But the point actually is not that I do net see the properties or do not get them at all, but that those properties do not contain the data I expected to be there - perhaps those data are stored somewhere else?
|
|
|
|
|
Meanwhile I had following idea: a Template has a Path property which shows the folder where it is stored, and a FullName property showing the full path including file name. Now I can iterate through all *.dot* files in that directory for getting other templates (and add a button for allowing the user to select a template stored elsewhere).
"AutoText " got a different name for every new version Word (at least for the German edition where it is called "Schnellbausteine" with Word 2007), hence let me explain shortly how to generate and use them.
Imagine, you often have to write "Blah blah blah! " in your documents. Write it once, mark the text, press <ALT><F3>. A dialog pops up where you enter an abbreviation for that text (e.g. "b3"), and save it (default is "Building Blocks.dotx " with Word 2007; it is located in C:\Users\user_name\AppData\Roaming\Microsoft\Document Building Blocks\language_ID ). Next time, you simply type "b3<F3>" and the abbreviation is replaced with the full text.
For that example, I selected "Normal.dotm " for saving it - and guess, now this AutoText shows up in the AutoTexts property of NormalTemplate .
For other AutoTexts, I will open that "Building Blocks.dotx" - but I really do not like that because of the language id in the path name...
If you have a more elegant version, please tell me.
|
|
|
|
|
In my 3 layer application, while I try to compile my business layer, I was getting the following error:
"Task failed because "sgen.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the "ToolPath" parameter of the task. CnCCore"
This is happening only when I try to compile the project in Release Mode. While compiling in Debug mode, there are no issues. It would be great if anybody can provide some solution to resolve this issue.
I googled the error for sometime. Majority of the solution says, to write the key in registry or reinstall the .Net Framework 3.5 version. Is there any other better possible way to avoid this?
I am not sure how to do the fourth resolution. Is this again, writing in registry?
Thanks in advance,
meeram395
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Have you checked the path as listed above to ensure that it exists, and that sgen.exe is present in the bin sub-directory?
I must get a clever new signature for 2011.
|
|
|
|
|
meeram395 wrote: This is happening only when I try to compile the project in Release Mode.
That is a clue. Check and compare your debug and release configuration. I'm going to take a wild guess of missing path in release config.
|
|
|
|
|
Am I the only fool using .NET in here?... haha
In the process I´ve explained here the property Process::HasExited is true from the moment the process starts.
The same occurs with the method void extProcessWorkCompleted (System::Object^ /*sender*/, System::ComponentModel::RunWorkerCompletedEventArgs^ e) which is called when the process starts, and not when it actually finishes.
Has this something to do with the process´s code or am I doing something wrong?
|
|
|
|
|
piul wrote: Am I the only fool using .NET in here?
I don't know.
piul wrote: am I doing something wrong?
Most probably.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Well... I was trying to make a joke, nothing else. I´m sorry if that dissapointed someone.
|
|
|
|
|
No one is disappointed. It is NOT sensible to rewrite about same question.
And we have Message Type, which has Joke in it.
If you want to Joke, come and have a good joke at Lounge.
|
|
|
|
|
Foolish,
The extProcessWorkCompleted event is raised when the process starts? Definitely someone has got it wrong. Couldn't see any MSDN documentation on extProcessWorkCompleted so I'm guessing it's you.
"You get that on the big jobs."
|
|
|
|
|
piul wrote: The same occurs with the method void extProcessWorkCompleted (System::Object^ /*sender*/, System::ComponentModel::RunWorkerCompletedEventArgs^ e) which is called when the process starts, and not when it actually finishes.
Some executables finish immediately after spawning a child-proces. Can you compare the Process-ID of the executable that you started to the one that seems to be running?
I are Troll
|
|
|
|
|
I have a time consuming process that is called from a Windows forms application and run asynchronously in another thread, when the user clicks on runButton
extProcess = gcnew System::Diagnostics::Process;
extProcess->StartInfo = gcnew System::Diagnostics::ProcessStartInfo;
extProcess->StartInfo->RedirectStandardOutput = true;
extProcess->StartInfo->UseShellExecute = false;
extProcess->StartInfo->FileName = EXTPROC_EXE;
extProcess->StartInfo->CreateNoWindow = true;
extProcess->OutputDataReceived += gcnew System::Diagnostics::DataReceivedEventHandler (this, &Form1::StdoutHandler);
try
{
extProcessThread->RunWorkerAsync();
The thread is launched and the standard output is read, to be shown in real time in a textBox in the main window
void extProcessThreadDoWork (System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
extProcess->Start();
extProcess->BeginOutputReadLine();
}
void Form1::StdoutHandler (Object ^ sender,
System::Diagnostics::DataReceivedEventArgs ^output)
{
textBox->AppendText (output->Data + "\n");
}
The problem comes in this last line. An exception is launched "Control accessed from a thread other than the thread it was created on"
I do understand why, but I don´t know how to solve it...
|
|
|
|
|
|
You need to have a look at the invoke methods in the article shown by the other poster
MSDN: Look at the example at the bottom of the page[^]
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
This[^] explains it, however all examples are C# or VB.NET; same principles apply to C++/CLI.
Amd a BackgroundWorker's ProgressChanged and RunWorkerCompleted handlers don't have the cross-thread problem as they run on the thread that created the BGW, which normally is the main thread. That is one of the big advantages of BGW.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I have a windows Forms application that calls a mathematical calculations .exe
superMinerProcess->Start();
superMinerProcess->BeginOutputReadLine();
while (!superMinerProcess->HasExited)
{
If I set a breakpoint after the Start(); the program only reaches it after the process has finished. I don't understand... Any idea?
|
|
|
|
|
That is inconclusive. Where is this code located? what is in the while loop? what is it you are trying to achieve?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|