|
hi Mr.Senthil,
how do u do?. Thank u very much for ur reply. well here whatever u said is ok. But the prob is this is not possible in case Winforms i have some prob. coz compiler never knows what is the parent form for it at compile time. i hope if u see the code fragment u can understand the prob.
in parent form:::
public:
ChldForm *child;
String* info;
System::Void Form1_Click(.......) {
info="Check Application";
child=new ChldForm();
child->ShowDialog(this);
}
System::Void timer1_tick(....) {
/// the info value changes for each 2 minutes
info=......;
}
in child form i am using this to call.
this->Owner->info;
but the problem is that compiler cant guess who is the parent here. so i used the type cast for this.
((parent*)this->Owner)->info
But it says that the parent is not the member of the present namespace. How do i solve this.
i got a solution for this. But this is not optimized.
thank u for ur reply once again.
regards,
Basheer.
|
|
|
|
|
Think about it the other way around, put a public property in your child form that is set by the parent form when the child form is constructed. The property could reference whatever you like, so let's say you have a text box in your parent form, you can have a public property in your child form like this:
private TextBox _parentTextBox=null;<br />
public TextBox ParentTextBox<br />
{<br />
set{ _parentTextBox=value;}<br />
}
When you create your child from from your parent form, set it's "ParentTextBox" property to your parent forms corresponding text box and you now have full access to it.
Of course it doesn't have to be a text box, it could be any object in your parent form and it doesn't have to be a property, you could just make it a parameter in the constructor of your child form depending on how required or not it is.
This is much clearer and more portable than trying to cast the parent form to gain access to it and easier to ensure there are no problems down the road with changes etc.
"Hello, hello, what's all this shouting, we'll have no trouble here! This is a Local Shop for Local People, there's nothing for you here!"
-Edward Tattsyrup
|
|
|
|
|
hello,
thank u very much for ur reply. i did the same and got the solution. Thank u once again
|
|
|
|
|
On a web page from Microsoft I discovede that .Net 1.1 SDK cannot be installed on a 64 bit processor(http://msdn.microsoft.com/netframework/technologyinfo/sysreqs/default.aspx[^]), but on the main download page it is not mentioned.
Can enybody confirm that on an 64 bit architecture the sdk can not be installed (or it doesn't work)?
I hope we understand...because is a rough world out there...
|
|
|
|
|
I guess it depends on which of the 64 bit platforms you're using, IA64 (Intel Itanium) or x64 (AMD). You can install and run the SDK on x64 just fine, as the platform supports running 32 bit applications natively. Win64 might run it on WoW, but it still will run fine.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for the reply...
I understand...even thought is a rough world out there...
|
|
|
|
|
Well, VS 2003/.NET 1.1 will certainly run on an AMD 64 machine. That's what I'm using at the moment.
Kevin
|
|
|
|
|
The BindingList<t> class is not serializable, but the List<t> Items are. Does this seem strange to anyone else? Since Items are protected, can anyone help me understand how to implement a Serializable BindingList? Thanks.
Where ever you go, there you are.
|
|
|
|
|
Thanks to Mav in the C# group, here's the answer:
///
/// The item list, used for Serialization.
///
[XmlElement(Type = typeof(<t>), IsNullable = true)]
public ArrayList ItemCollection
{
get
{
ArrayList alist = new ArrayList();
foreach (<t> item in this.Items)
{
alist.Add(item);
}
return a;
}
set
{
ArrayList alist = value;
foreach (<t> item in alist)
{
this.Add(item);
}
}
}
You'll need to change the <t> to your specific type, since the serializer doesn't generic.
Have fun.
Where ever you go, there you are.
|
|
|
|
|
Hi Folks,
I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this
worked fine. When moving to .NET 2.0 I get a couple of unresolved externals /
linker errors:
Error 16 error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??1logic_error@std@@$$FUAE@XZ) Parameter.obj
Error 17 error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public:
__thiscall std::bad_alloc::bad_alloc(char const *)"
(??0bad_alloc@std@@$$FQAE@PBD@Z) Imagic.obj
Error 18 error LNK2028: unresolved token (0A000008) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??1logic_error@std@@$$FUAE@XZ) Align2D.obj
Error 19 error LNK2028: unresolved token (0A000347) "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) referenced in function "public: virtual void
* __thiscall std::logic_error::`vector deleting destructor'(unsigned int)"
(??_Elogic_error@std@@$$FUAEPAXI@Z) Parameter.obj
Error 20 error LNK2028: unresolved token (0A0003D3) "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) referenced in function "public: virtual void
* __thiscall std::bad_alloc::`vector deleting destructor'(unsigned int)"
(??_Ebad_alloc@std@@$$FUAEPAXI@Z) Imagic.obj
Error 21 error LNK2028: unresolved token (0A000358) "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) referenced in function "public: virtual void
* __thiscall std::logic_error::`vector deleting destructor'(unsigned int)"
(??_Elogic_error@std@@$$FUAEPAXI@Z) Align2D.obj
Error 22 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) Align2D.obj
Error 23 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) AssemblyInfo.obj
Error 24 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) Imagic.obj
Error 25 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) Parameter.obj
Error 26 error LNK2019: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??1logic_error@std@@$$FUAE@XZ) Align2D.obj
Error 27 error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) Imagic.obj
Error 28 error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) Parameter.obj
Error 29 error LNK2019: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) referenced in function "public: virtual void
* __thiscall std::logic_error::`vector deleting destructor'(unsigned int)"
(??_Elogic_error@std@@$$FUAEPAXI@Z) Align2D.obj
Error 30 error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) Imagic.obj
Error 31 error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$FYMXPAXIHP6MX0@Z@Z) Parameter.obj
Error 32 fatal error LNK1120: 9 unresolved externals Debug\empDll.dll
In my .NET 1.1 Project I had to make the following Linker Settings to build
the DLL:
1.) Additional Dependencies: mscoree.lib msvcrt.lib (or msvcrtd.lib for
debug version) mystaticlib.lib
2.) Ignore Specific Library: nochkclr.obj
3.) Force Symbol Reference: __DllMainCRTStartup@12
In my Wrapper Classes I had to add the following:
#using <mscorlib.dll>
using namespace System;
using namespace System::Runtime::InteropServices;
This does not work any longer with the new Visual Studio and the new .NET
Framework.
The only article that I was able to find on this subject:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/TransGuide.asp
Doesn´t mention Linker settings at all.
Could anybody please help me or tell me where to go for further reading?
Thanks in Advance for your efforts.
Chucker
|
|
|
|
|
Hi there,
didn't know where exactly to post this. Hope it's ok here.
I'm just wondering, whether there is a possibility to include/exclude files in different build configurations. Say in Release config, I'd like to distribute this set of *.sql, *.txt and *.config files and in Debug config, there are just different files to go. Any ideas?
Any help is greatly appreciated.
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
Hi All,
I've tried to add the UrlEditor window to a property for a custom control I created.
Here is my code :
[
Category("Data"),
Description("URL associated with the link."),
DefaultValue(""),
EditorAttribute(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))
]
public string urldata
{
get
{
return urlData;
}
set
{
urlData = value;
}
}
Then, when I use my custom control, I have the urldata property, I can write any string I want into it, I also see the "..." button at the right, but nothing appears when I click on it.
What did I wrong ? Why does this UrlEditor not show up ?
Thanks ! Stéphane.
|
|
|
|
|
Hi all,
Im looking for a way (.net or not) to monitor file access and permit access to certain application to it...
I want to be able to get an event saying (this file) tries to do "this" to this file
Acess - Deny
Thanks
|
|
|
|
|
You can check out FileMon on www.SysInternals.com. It uses a custom .DLL to do something very similar. There's no source, but there is a discussion of how it's done. Be warned, it requires a black-belt in NTFS Internals to write it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know a straight foward way to insert a string at the beginning of a text file that already has data in it? I thought there was an insert function in the StreamWriter, but apparently not.
For my purpose, the insert will always be at the beginning of the file and it doesn't matter if the first line is overwritten or not.
Thanks,
RABB17
Know thy limits, then add 1.
|
|
|
|
|
Figured it out. It was in the FileStream, not the StreamWriter. If anyone ever needs to do this:
System.IO.FileStream f = SupportClass.RandomAccessFileSupport.CreateRandomAccessFile(MyApp.playFileName, "rw");
int fileLength = f.Length;
line = "This is written in front of this many characters: " + fileLength.ToString();
f.Seek(0, System.IO.SeekOrigin.Begin);
//insert blank line at top of file
SupportClass.RandomAccessFileSupport.WriteBytes("/n", f);
//return to top of file
f.Seek(0, System.IO.SeekOrigin.Begin);
SupportClass.RandomAccessFileSupport.WriteBytes(line, f);
//return to end of file
f.Seek(f.Length, System.IO.SeekOrigin.Begin);
f.Close();
|
|
|
|
|
Yeah, to do a true insert of text into the file, you must rewrite the entire file. There's no other way to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am running into a very frustrating problem with an application which works with threads.
Basically, what I am doing is creating a number of threads which I use for executing procedures. I cannot use the thread pool as the application does not suit itself to that sort of methodology (I will need to have greater control over the individual threads). For this reason, I am creating threads and keeping them around until I need them and then using them as needed.
Anyway, what I am seeing is that, if I have my threadStart procedure use a "while not terminated" type loop, the thread takes up lots of CPU time. For example, here is the ThreadStart:
private void doSomething()
{
while (fKillThread != true)
{
doSomethingElse()
System.Threading.Thread.CurrentThread.Suspend();
}
}
In theory, this should run ONCE and then suspend itself and take no further CPU time. However that is definitely not the case. Instead, these threads peg the CPU at 100%. It is almost as if it is continuously evaluating the while condition instead of doing it once and suspending.
So, why does .NET Thread.Suspend() not actually put the thread to sleep until it is called inside of a while loop?
If I eliminate the while loop and just call suspend(), it suspends and takes no CPU time at all.
Can anyone shed some light on what is going on here?
thanks
[edit]
I found this post that looks like the same thing is happening:
http://www.highdots.com/forums/visual-studio-net-debugging/thread-suspend-causes-100-cpu-2194189.html
this was from back in 2003 - anyone know if it was ever fixed or is .NET threading just broken until I upgrade to 2.0? Is it fixed there???
khariV
-- modified at 5:02 Thursday 3rd November, 2005
|
|
|
|
|
I checked you code in 2.0. Besides the fact that Thread.Suspend() is Obsolete is working fine and you have no CPU penalty.
|
|
|
|
|
thanks for the check. While I'm not sure when we'll officially move over to 2.0, it's good to know that when we do this issue will no longer be a problem.
You say that Thread.Suspend() is obsolete - what is the new methodology for suspending threads? Do they recommend you create/free them all the time (Im going to have potentially LOTS of processes, so I figured this would be a lot of overhead).
I know I can avoide using suspend() and instead switch over to events, but is there a new and improved thinking on this for the 2.0 world?
thanks again
khariV
|
|
|
|
|
|
If you have to use 1.1 try to set your thread as background one.This may eliminate the cpu consumption inside the loop.just a thought.
|
|
|
|
|
Based on the link you gave, it looks like Thread.Suspend is buggy. How about using some other mechanism to suspend and wakeup threads, like ManualResetEvent s, for example?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello,
I've created a subclass of the Button class and I can't figure out why my OnPaintBackground method never gets called. Have any of you ever encountered this problem?
Gus
|
|
|
|
|
I figured it out:
this->SetStyle(ControlStyles::Opaque, false);
Just FYI...
Gus
|
|
|
|
|