|
What is the state of the databases before hand ? Do you know the schema ? Do both databases exist ? Can you write whatever stored procedures you like on these databases ? The easiest thing would be to drop all foreign keys and so on, then copy the data across, a table at a time, and finally readd the constraints. But I'm also assuming you only need to syncronise data.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a richtextbox with the following event handler for the ContentsResized event. The richtextbox Multiline property is set to true and the Scrollbars property is set to none.
The problem I have is when typing in lines of text. The first line dissappears (scrolls) above the top of the richtextbox. Other than that the richtextbox resizes itself accordingly.
Can anyone please help me rectify this problem? Am I using the correct method? Is there a better way to do it?
The code for the event handler:
private void ContentsResized(object sender, System.Windows.Forms.ContentsResizedEventArgs e)
{
// Create a new object that refers to the control that fired the event
RichTextBox richBox = (RichTextBox)sender;
Font stringFont = richBox.Font;
string queString = richBox.Text;
System.Drawing.Graphics objGraphics;
objGraphics = CreateGraphics();
SizeF layoutSize = new SizeF(richBox.Width, ClientRectangle.Height);
SizeF stringSize = new SizeF();
stringSize = objGraphics.MeasureString(queString, stringFont, layoutSize);
richBox.Height = Convert.ToInt32(stringSize.Height);
objGraphics.Dispose();
resetPositions();
}
|
|
|
|
|
Hello, guys
I got a problem of calling class methods from C++ dll in my C# program.
My old dll is standard C++ dll. For non-class methods, I decorate the method with:
extern "C" _declspec(dllexport)double myMethod(double b, double h);
Then I can use the following to call the method foo in C#.
[DllImport("my.dll")]
public static extern int foo();
But if it is a class, I use the following syntax to decorate it:
class __declspec(dllexport) myClass{
... ...
}
But this time, I don't know how to it and .NET throws exception of "Additional information: Unable to find an entry point named fndllclasstest1 in DLL my.dll".
Could anyone help me figure out how to call class method from a standard dll in C# applications?
Many thanks
Ivyhill
|
|
|
|
|
go to command prompt where your dll is located.
type: dumpbin -exports xxx.dll
you might get something like this
1 0 00001B60 ?Foo@@YAXXZ
with some other data. The data above is your exported function from your c++ dll.
Next step is to get the function.First, you need this line to interoperate between your c++ dll and c#
using System.Runtime.InteropServices;
Then this is how you call your function by setting the entry point to the information given.
[DllImport(@"cntr.dll", EntryPoint="?Foo@@YAXXZ", CallingConvention=CallingConvention.StdCall, SetLastError=true)]
public extern void Foo();
that's all you need.
|
|
|
|
|
Thanks Mervick. It works.
|
|
|
|
|
I have the following two chunks of code:
1)
NetworkStream networkStream = new NetworkStream(member.socket);
System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(networkStream);
...
2)
NetworkStream networkStream = new NetworkStream(s);
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(networkStream);
...
What would be the order for closing the streams and flushing? And do I need to do both on both the client and server side?
IE:
1)
streamWriter.Flush();
streamWriter.Close();
networkStream.Flush();
networkStream.Close();
2)
bw.Flush();
bw.Close();
networkStream.Flush();
networkStream.Close();
Thanks
|
|
|
|
|
You don't need to close the NetworkStream after closing the StreamWriter , the StreamWriter does it for you. MSDN says "Closes the current StreamWriter and the underlying stream". And closing the StreamWriter flushes it, so you don't need to Flush<code> before <code>Close
In short, all you need is
streamWriter.Close();
And you must close it both on the client and the server, each end creates some resources that must be released by calling Close .
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks.
|
|
|
|
|
I've 2 forms i want set a text inside the second form by the first one.
If i try i get a compiler error about permissing, the object (textbox is private).
What i heve to do?
|
|
|
|
|
hi,
can you change class where is your textbox private ? If so you can change textbox's modifier to public (not recommended) or internal (better) or you can write property for setting/getting value of textbox (recommended).
public means that everybody can directly change textbox's value - that's not good idea. internal means that everybody (classes) in same assembly can change textbox's value - that can be useful in some scenarios. By writing (public) property, you gain control over how and when can value change... e.g. you can have test for valid format of string or something and change actual value only if it's format is ok...
hope it helps
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
i've tried to set on modifier the value public but i get not permissing yet. why?
[quote]
you can write property for setting/getting value of textboxt
[/quote]
can you show me how?
|
|
|
|
|
Anonymous wrote:
you can write property for setting/getting value of textboxt
Anonymous wrote:
can you show me how?
public string TextBoxText<br />
{<br />
set(this.textBox1.Text = value;)<br />
get{return this.textBox.Text;}<br />
}
|
|
|
|
|
KEF
|
|
|
|
|
|
Is that a new code in c 2.0 ?
|
|
|
|
|
Is there a good way to debug Client/Server code, or rather, code in general? I have not familiarized myself with the Debugging options and therefore have noticed some odd behaviors IE: in debug mode, the program acts a certain way, which is wholly different from the way it acts during regular execution. Any good articles regarding .NET debugging that could aid me? Thanks.
|
|
|
|
|
In Visual Studio, you can go into the properties of your solution that contains both client and server projects, and set the start-up project to include both client and server projects. That way, when you start debugging, both client and server will be launched under the debugger.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
You are running into the classic problem with these client-server systems. The Client and the Server are operating in different application domains that occationally overlap and communicate with each other. Trying to debug these types of systems requires a level of understand that goes beyond what is normally done in "regular execution". Objects are not automatically available to either domain. Paths as well as context sensitive information are not the same in either domain. So on and so forth.
It is almost always easier to debug the Client application domain. The development tools are often available as well as the process so you can just attach the debugger and go. The Server application domain is often unavailable especially when on another machine that might not even be on the same network. It is also often a very bad idea to stop the server application domain in mid processing since whatever resource is still waiting for it to complete, like IIS. Defer processing or delay too many of these and your server can start acting weird.
One trick I always like to do especially if IIS is available is to report right to the HttpContext which can be inspected by "Trace.axd". Another trick I've learned to use is to have extensive log files that are coded into the server portion.
|
|
|
|
|
|
Well I'm assuming that if you have the means of installing the software on the server you also have the means of reading a log file too. The trick is of course is that is that there are multiple processes loging events so you have to do some heavy filtering to get any meaning out of it.
|
|
|
|
|
GRRRR. WORK DAMMIT.
Right so im using this to get files from my rescources:
<br />
ResourceManager rm = new ResourceManager("MyApp", this.GetType().Assembly);<br />
globalvars.HouseImage = (Image)rm.GetObject("house");<br />
Now this works fine for my pictures and whatnot, but im also using DirectX to play my sounds (Damn right i got that working - no SDK)
so its just
<br />
music = new Audio(@"filename");<br />
music.Play();<br />
but how can i play the file in my resources, i cant use:
<br />
globalvars.music = (Audio)rm.GetObject("song");<br />
<br />
<br />
globalvars.music.Play();<br />
(well the code is accepted but when the app starts i just get the error message)
So HOW CAN I PLAY THE FILE (from my resources and not from an external folder)
and GRRRRRR once again
|
|
|
|
|
The problem is that you need to take your raw resource (an .mp3 file or similar) and generate a DirectX.AudioVideoPlayback.Audio object from it. I don't remember offhand, does Play() allow passing in a stream instead of a file name? From there, you could get your resource object as a byte[], put it in a stream, then play the song from there.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
Hi,
I get the following error in an application.
System.Runtime.InteropServices.COMException (0x80040154): ?
I have set up a test machine where I can reproduce the error and it seems to be at a point where I am using SQLDMO to connect to a database. The wierd thing is that it works fine on my machine but not on a workstation. the only difference between the machines as far as database is that I have SQL Server 7.0 on my machine and the test machine does not.
How can I find out what is needed to resolve this issue as far as files etc?
Thanks
|
|
|
|
|
0x80040154 is an HRESULT error that translates to "Class not registered."
Do you have MDAC[^] installed on the test machine?
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
MDAC installed fine when I installed the framework for .NET.
|
|
|
|