|
Not possible with top-level types in C#. There is no real eqivalent to c++ friend access level.
Your only alternative would be to derive the class that needs access from a puplic top level class that contains the class you want to access as a protected or protected internal class, which is a kludge that sort of defeats the pupose of not making the class you need access to public in the first place.
What is your employer REALLY trying to accomplish here? Do you need access to the entire class, or just a few methods? Do you need to instantiate the class in the other assembly?
Would a public wrapper class containing an instance the 'protected' class and exposing only the desired methods suffice (i.e. a facade)?- expose the facade class via a public class factory...
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
I'm not sure what the attribute is right now, but there is a way to make objects callable only from specified assemblies. If ur calling object is managed and u can place it in an isolated assembly then u can reach the solution u are looking for.
|
|
|
|
|
Apparently, VS2005 has a new attribute
[VisibleFromAssembly="ASSEMBLY_NAME"] which I'll be able to use.
I'm not sure that's the exact attribute name, but it's something similar that can be applied at the class level, for instance, to an internal class.
|
|
|
|
|
How can I Insert the values in the text in the nodes of the Treeview?
|
|
|
|
|
Try checking out the documentation for TreeView.Nodes.Add(string)[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have created a propertygrid and a dialog form in Windows Form.
How can I make my dialog form pop up when i click on the attribute of my PropertyGrid?
Can first give a reference site where i can find out the answer cause it is quite urgent.Preferably an executable program..
Deadline approaching... Please help...
Thank you
|
|
|
|
|
Searching about EditorAttribute .. you will find your solution.
And you might need this as well TypeConverterAttribute.
Hope this help
|
|
|
|
|
I have manage to make my PropertyGrid pop up Font form from the System.Windows.Drawing but no luck with my own defined form class, i try to make it pop up like the Font, intead it select all the Windows.Form properties inside my PropertyGrid.
Please help!!!
|
|
|
|
|
I am trying to create a timer that will pause the program for 1.5 seconds. I need something that pauses but does not stop the Thread.
In a nutshell, here is what I am doing. I have two cards that appear on the screen. I want them to stay there for 1.5 seconds and then re-draw back to a default value.
I have tried the Thread.Sleep but that pauses the entire program and prevents the one card from displaying at all (even though the sleep is called after the line to display the card).
Any help would be appreciated.
|
|
|
|
|
Monitor.Wait(new Timespan())
|
|
|
|
|
Can you be more specific. I can't get that to work either.
Here is the code I have tried using:
private void P1Flip_Click(object sender, System.EventArgs e)
{
GetCard(1);
Player1Card = P1Card.GetCardNum();
Invalidate();
P1CardPlayed = true;
P1Flip.Enabled = false;
if (P1CardPlayed && P2CardPlayed)
{
PlayGame();
if ((winner == 1) || (winner == 2))
{
Threading.Thread.Sleep(WaitTime);
Player1Card = 67;
Player2Card = 67;
UpdateCardsLeft();
P1CardPlayed = false;
P2CardPlayed = false;
P1Flip.Enabled = true;
P2Flip.Enabled = true;
}
else
{
ShowWarMessage();
P1War.Enabled = true;
P2War.Enabled = true;
P1CardPlayed = false;
P2CardPlayed = false;
}
}
}
My problem is even though the Threading.Thread.Sleep(WaitTime) is after the Invalidate() command, the screen is not re-drawing until after the WaitTime? This is driving me nuts.
|
|
|
|
|
Bob Bonser wrote:
My problem is even though the Threading.Thread.Sleep(WaitTime) is after the Invalidate() command, the screen is not re-drawing until after the WaitTime? This is driving me nuts.
Try throwing a Application.DoEvents(); in just before you put the thread to sleep. This will give the window the opportunity to respond to the WM_PAINT message it's about to receive.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi
i want to zip a file or folder at runtime . is there a command for running to zip a folder in windows ? ( i have win XP so i think must there is a command for this work )
Regards' Amir jalaly
|
|
|
|
|
Although XP has the ability to READ zip files and display them like they were directories, I don't beleive it has the ability to create them. There are a number of open source librarys like this one[^] that provide some zip creation support.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Rob Graham wrote:
I don't beleive it has the ability to create them
You might be happy to try...
Right click File or Folder.
Send To -> Compressed (zipped) Folder
|
|
|
|
|
That makes a compressed NTFS folder, not a zip file....
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Is this information incorrect then?
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsXP/UserTips/Miscellaneous/CompressedZippedversusCompressionFoldersinXP.html
The article says that MSFT has used code based on WinZip7.
|
|
|
|
|
My Bad! You appear to be correct.
so the answer to the original request is....?
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Wont work. All you need to do is create a new Text file on the Desktop or where ever you need in the file system, then rename it with a .ZIP extension. You can then drag and drop all the files you want into the new .ZIP.
I don't know how to get this to work in code though. For backward compatibility with Windows 2000/NT, you might want to try the #ziplib[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You're right... I was just responding to the notion that WinXP has no support for creating (actual) ZIP files.
|
|
|
|
|
Hello
How can I marshalling an array of structures from c# to an unamanaged c++ code?
Is is possible?
Thanks in advance.
|
|
|
|
|
Yes, it's possible. Check out this[^] little sample on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello I'm pretty new to C# and programming in general. Anyway I was playing with WMI and have some code that will query a local machine and display some basic info about the local machine to the command prompt.
I would like to redirect this to a a MSDE database, could anyone let me know how I do this?
This is the code I have:
//WMI.cs
//Extracts computer system information using WMI
using System;
using System.Management;
namespace WMI
{
///
/// Summary description for Class1.
///
class Class1
{
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem") ;
ManagementObjectCollection queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine("Name : " + mo["name"].ToString());
Console.WriteLine("Version : " + mo["version"].ToString());
Console.WriteLine("Manufacturer : " + mo["Manufacturer"].ToString());
Console.WriteLine("Computer Name : " +mo["csname"].ToString());
Console.WriteLine("Windows Directory : " + mo["WindowsDirectory"].ToString());
}
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem") ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine("Manufacturer : " + mo["manufacturer"].ToString());
Console.WriteLine("Model : " + mo["model"].ToString());
Console.WriteLine(mo["systemtype"].ToString());
Console.WriteLine("Total Physical Memory : " + mo["totalphysicalmemory"].ToString());
}
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_processor") ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["caption"].ToString());
}
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_bios") ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["version"].ToString());
}
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_timezone") ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["caption"].ToString());
}
}
}
}
Cheers
|
|
|
|
|
There is one more thing I don't know how to do...
This is a picture of my program
[IMG]http://img225.exs.cx/img225/9963/clipboard019vo.jpg[/IMG]
I want to add some numbers to these text fields (it would be optimal if a user can write just number or text,depends on my choice when creating text boxes). And when all fields are written user have to press right button bellow these text fields.
Now I would like that when user press that button, values from these text field replace values in existing data.txt file in some directory (for example C://prgram files/...) and program runs (for example blblbl.exe - fortran program). How can I do that?Also there is posibility that values in text box create new text docuent called data.txt in particular directory. That would be also grat!
Stefan tried to help me, but I am plain beginner and I didn't understand him much.
|
|
|
|