|
Thanks - looks like I win and C# loses. It's such a shame to find myself fighting the language.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
You don't need to do that for a string object. strings are immutable so no changes can be made to it.
All methods on string that would do any modification return a new string object containing the changes.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thanks - I know that, I just wrote the first example that sprang to mind. The object I actually want to pass is an XmlNode, and I dunno that this will help, because once I get back the node, I can still call methods on it that change it.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
I am trying to use a library file that I created in MFC Visual C++. It
won't let me include it as a reference so I am assuming I need to do
something like this:
[DllImport("MyDLL.dll")]
private static extern bool Counter(out long lpCount);
However I don't just wanna import a method I wanna make an instance of the
class which is called CAppBar. Can anyone point me in the write direction
here? It would be a huge help thanks...
|
|
|
|
|
P/Invoke only lets you hook up to static functions; you can't create C++ instances, as the CLR and C++ rules for how classes work are quite a bit different.
To do this, you'd need to wrap it using the Managed Extensions to C++.
|
|
|
|
|
Welcome,
Have you got any example how to put Bitmap (created during working of application) and than put it (embedded) in RichTextBox control.
Bitmap is created in the memory (not reading from file).
thx
|
|
|
|
|
Hi
I have tried to do something similar and there seems to be 2 ways:
1. Easy - place bitmap object in clipboard and paste to richtextbox. Problem that u use the clipboard and mite "lose" data that still needs to be there.
2. Hard - Create a RTF file in a word processor with required bitmap, save the file. Now add that to the Rtf of the richtextbox. This could coause many problems though
3. Ideal solution - Every stick together and make a proper WordProcessingTextBox with all the features we always wanted . Like highlighting
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
Hi
I have tried to do something similar and there seems to be 2 ways:
1. Easy - place bitmap object in clipboard and paste to richtextbox. Problem that u use the clipboard and mite "lose" data that still needs to be there.
Hmm I did't think about it... but how to copy bitmap from Form (for example I would like to write some kind of chart and put it into rtf)
leppie wrote:
2. Hard - Create a RTF file in a word processor with required bitmap, save the file. Now add that to the Rtf of the richtextbox. This could coause many problems though
In my case it couldn't be done.
leppie wrote:
3. Ideal solution - Every stick together and make a proper WordProcessingTextBox with all the features we always wanted . Like highlighting
That's cool. But unfortunately I don't have time to do it
(but maybe in future it is good idea
|
|
|
|
|
I am looking for something similar to a feature Delphi has, that allows you to
- create a "Data Module"
- add database components (connections, tables, views)
- use the data module in any form (it works with the visual tools too).
I can't seem to find anything similar for a Windows Forms C# application.
What I would like to do, is have one database connection always open, and available to any form.
It's quite trivial to do it in code, but how can you make the visual designer tools "see" this connection?
|
|
|
|
|
I try to write a .vsz file, but when I use it in vs.net, vs.net always told me "Could not run xxx.vsz file"!
I'm amumu, and you?
|
|
|
|
|
How do I detect, at runtime, what the .NET Framework Version is?
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
System.Version
I'm amumu, and you?
|
|
|
|
|
System.Version is a class that represents a version number; by itself it doesn't tell you the version number of the framework but System.Environment.Version will tell you the version of the CLR.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Hey, thanks for the reply, James. Apparently, though, the .NET Framework Version is not the same as the script directory that ASP.NET uses. What I mean, is that System.Environment.Version returns 1.0.3705.209, but the ASP.NET script files (WebUIValidation.js, etc.) are in a folder called 1_0_3705_272. Ideally, I'd like to be able to get this folder without having to enumerate its siblings, and look for the highest revision number.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
why are you trying to muck around with the asp.net script files?
|
|
|
|
|
I'm not trying to modify them or anything. I created a custom validator (that implements IValidator, but doesn't derive from BaseValidator), and was hoping I could just use the available script for client side validation, rather than have to rewrite my own.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
BaseValidator gets the path to the script files from the internal static System.Web.UI.Util.GetScriptLocation method, which gets some of its info from the internal System.Web.Util.VersionInfo.SystemWebVersion property.
GetScriptLocation looks up the "clientScriptsLocation" setting in the machine.config file. but that string has parameters which are filled in by SystemWebVersion.
You might be best off either using reflection to get to the GetScriptLocation method, or querying the .config file for the root path, and then scanning that folder for the highest version.
|
|
|
|
|
Hi, I have a little problem with the 'Clipboard' class. I am attempting to transfer data from the windows clipboard to a bitmap object and appear to be leaking memory. The following code placed in a button on a windows form will cause a significant amount of memory to be allocated and only partially freed. You must manually 'copy' an image onto the clipboard prior to running this code.
System.Drawing.Bitmap bm;
IDataObject iData;
iData = (IDataObject) Clipboard.GetDataObject();
for (int i = 0; i < 100; i++)
{
if (iData.GetDataPresent(DataFormats.Bitmap))
{
bm = (Bitmap) iData.GetData(DataFormats.Bitmap);
if (bm != null)
{
bm = null;
}
else Console.WriteLine("Bitmap was NULL");
}
}
If the 'bm=(Bitmap)...' line is commented out no memory will leak.
I have been using an approximately 512x512x32 BMP for my tests.
Note : This code is simply to test the leaking problem. The real code places a different image on the clipboard every time through the loop and then works with the data in the if (bm != null) {...} block.
|
|
|
|
|
How are you checking the memory use? There's nothing in your code that forces the bitmap to be freed, so memory is going to be hanging around until a GC happens.
You could call bm.Dispose() to free it early.
|
|
|
|
|
I have tried inserting a GC.Collect(); after the BM=null; line. This did not seem to have any effect. I also placed a GC.Collect(); after the entire loop ran to see if it cleaned up any - it did not.
I have also tried replacing the
'bm = (Bitmap) iData.GetData(DataFormats.Bitmap);'
with
bm = (Bitmap) new Bitmap(512,512); // or whatever that constructor is
This then worked - the memory fluctuated by a couple megs up and down but after the routine exited left no memory in use. This was even without a GC.Collect(); line in the routine.
Oh, I also did try bm.Dispose(); but this also did not free the bitmap.
Lastly, I am looking at the NT's task manager - not the most fine of memory gauges, but each bitmap I get uses about 1 meg of memory. A loop of 100 iterations will cause the task manager to show nearly 100 megs more in use.
Thanks for the reply!
|
|
|
|
|
Is it possible to develop a disk format application without depending on windows or dos format tools?
Jassim Rahma
|
|
|
|
|
I added a status bar and a panel to a form. I then set the panel's borderstyle to fixed3d (this way I can see all sides of the panel) and set the dock property to DockStyle.Fill.
The problem is that the panel gets tucked underneath the status bar. This can be fixed by right clicking the panel and selecting 'bring to front'. Unfortunately I will be adding the panel dynamically, so I need a way acheive the same effect of 'bring to front' via code.
Any help would be greatly appreciated.
Thanks,
Steve
|
|
|
|
|
Try:
myPanel.BringToFront();
The BringToFront() method is part of the Control class.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Duh ! I don't know why I thought bring to front could only be used from the IDE. Man, I feel stupid.
Thanks Nathan
|
|
|
|
|
Not stupid.... Just overworked
Glad, I could be of help.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|