|
Is there any better way to hide property runtime other than [BrowsableAttribute(false)] ?
There is only PreFilterProperties for Design mode but I couldn`t find anything like this for runtime, anyone can help me out?
|
|
|
|
|
Hello,
I think I do not understand the question.
Vertyg0 wrote: hide property runtime other than [BrowsableAttribute(false)]
I allways thought, that the BrowsableAttribute effects design time.
If you do not whant to have an effect by changing a property during runtime, maybe you can use a
if(DesignMode) //is a Member of System.ComponentModel.Component
{
}
in your set accessor of the property.
Hope that helps you.
All the best,
Martin
|
|
|
|
|
I want to hide property.
For instance i want to hide Text property so that it doesnt show up in PropertyGrid at runtime.
|
|
|
|
|
At runtime, there is no direct way to hide a property. But you could use some methods presented in some of the articles here on CodeProject to manage the set of displayed properties. For example, the PropertyBag can allow you to choose what properties are displayed at runtime. More generally speaking, if you have a class derived from ICustomTypeDescriptor that publishes a set of PropertyDescriptors, you can choose to temporarily remove one of the properties. Hope that helps.
|
|
|
|
|
PropertyBag could be interesting thank you !
|
|
|
|
|
I have a WinForms project. I'd like to have a grid-like control (like the DataGridView) that can dynamically add and remove rows and have custom cell types.
However, instead of the cells having stuff that's LIKE comboboxes or LIKE pictureboxes, I want them to actually HAVE real, pure, genuine comboboxes or pictureboxes in them.
Is there an easy solution to this problem?
|
|
|
|
|
|
I need to retrieve the MD5 Hashcode from running processes, how can I do this?
|
|
|
|
|
Hi!... Can anyone tell me how to read the game port in visual C#. i know that the game port writes to some specific memory adress but how to read and mdoify it.
My aimm is to interface a thermistor through the game port to mesure temprature..
Thanks in advance
-- modified at 13:56 Friday 6th October, 2006
|
|
|
|
|
i think the best way is to use DirectX SDK direct input (joystick)
|
|
|
|
|
Thank you and if you can , please give some idea about the same
|
|
|
|
|
Hi
i paste a png image folder in soloution explorer.now how can i give path.
This time my png path is
btn_select_folder.BackgroundImage=System.Drawing.Image.FromFile(Application.StartupPath+@"\dbxpngs\001.png");
pashant
|
|
|
|
|
put directly it into bin\debug
while publishing make sure you put/include those it in the application folder
and for bin \ debug files you do not need to refer for a path
btn_select_folder.BackgroundImage=System.Drawing.Image.FromFile("001.png");<br />
|
|
|
|
|
i would add it as a resource
|
|
|
|
|
but the size of resourse file may dumpen the performance
if the image is small better use it as resource object
but on ther other hand if it is large it may cause performance issue
because it will consume ram even when it is not in use
|
|
|
|
|
Hey!
I have looked allover the internet after a way to do unit testing against a database with rollback as easy and flexible as possible.
I found this article:
http://msdn.microsoft.com/msdnmag/issues/05/06/UnitTesting/[^]
(http://msdn.microsoft.com/msdnmag/issues/05/06/UnitTesting/default.aspx?loc=&fig=true#fig5[^])
And I have tried to do the exact thing that roy Osherove shows.
I have two projects(dbContextTest(class library) and dbContextTest_Test(Test project))
The following class are placed within the dbContextTest class and is that class that I want to test:
public class userHandler<br />
{<br />
private databaseHandler dbHandler = new databaseHandler();<br />
<br />
public bool createUser(string inFirstName, string inLastName)<br />
{<br />
try<br />
{<br />
if(dbHandler.createUser(inFirstName, inLastName) > 0)<br />
return true;<br />
<br />
return false;<br />
}<br />
catch (Exception ex)<br />
{<br />
Console.WriteLine("Error in " + this.ToString() + ".createUser : " + ex.Message);<br />
return false;<br />
}<br />
}<br />
}
As you can see, I am here contacting the DAL(Database handler(dbHandler)) to add a user to the database.
In my test project I have a userTest class where I have my test methods:
[ClassInitialize()]<br />
public static void MyClassInitialize(TestContext testContext)<br />
{<br />
ServiceConfig config = new ServiceConfig();<br />
config.Transaction = TransactionOption.RequiresNew;<br />
ServiceDomain.Enter(config);<br />
}<br />
<br />
[ClassCleanup()]<br />
public static void MyClassCleanup()<br />
{<br />
if (ContextUtil.IsInTransaction)<br />
ContextUtil.SetAbort();<br />
<br />
ServiceDomain.Leave();<br />
}<br />
<br />
[TestMethod()]<br />
public void createUser()<br />
{<br />
string firstName = "Olle";<br />
string lastName = "Svensson";<br />
<br />
userHandler tmpUSHandler = userFactory();<br />
<br />
Assert.AreEqual(tmpUSHandler.createUser(firstName, lastName),true,"User not created");<br />
}<br />
<br />
private userHandler userFactory()<br />
{<br />
return new userHandler();<br />
}
I am here trying to make the userHandler class work with in a serten context that I have the possiblility to rollback.
I know that there is nothing wrong with my TestMethod.
When the SqlConnection.open is executed in the DAL I get the following exception:
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.
What am I doing wrong? And is this the way to solve the problem?
|
|
|
|
|
when a create a mdi child and open it, i found it behind the controls in the parent form
is there anyway to bring it in the fornt
|
|
|
|
|
No. Or atleast I do not think so. In MDI application you should not place controls in the client area of the main application form. If you do, then you will need to hide and show them as and when you have an MDI form open or not.
|
|
|
|
|
thanks i think that mean i should place all controls in client erea in the main form in another mdi form
|
|
|
|
|
you better dock the control on mdi
and for sending it back
right click the control and use send to back
if control is independent else do same for its container you can also do it in code
|
|
|
|
|
I have a program that needs to connect with another program developed by somebody else that currently will run on the same computer (by later that might change). The connection is being done using TCP/IP and the TcpClient class (on my side). The problem is that the other guy has his program rather rudely close every connection after receiving only one TCP/IP message and this is really annoying me.
Does anybody have a feel for what the additional overhead is with having to reconnect every damn time versus having a connection that will stay open until my app quits? We'll need to send messages probably only every few seconds (maybe every 5 seconds tops), but I want the response when the message is sent to be as quick as possible.
Thanks.
|
|
|
|
|
Creating a connection is causing the overhead of having a three-way handshake. So basically, if you don't close and re-open the connection you will not have this overhead.
I don't know if you use an IP-address to connect or a DNS name, if you're using DNS, this is causing more overhead too, because you have to query for the IP-address too.
You're right when you are saying that it is annoying having to reconnect, plus it costs more time and memory to reconnect at every request.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
I would like to add some shortcuts to my application in which multiple keys can be pressed to do some action or another. This wors fine for single button or ctrl/alt/shift combinations, but how can I handle other keys, like a combination of 'A' and 'Y' for example? Do I have to keep track of this manually in the key up / key down events? I'd expect there's some convenient way of handling this, but can't seem to find any info on this on msdn or google...
Cheers,
Benny
|
|
|
|
|
i was trying to change the tempo of a midi file while playing
but was unable to find a way
can you help
thanks
|
|
|
|
|
Hello
I´ve got a string and i would like to convert into an int but the problem is that when i don´t have an int an exception is throw (FormatException). How can i catch this expceion? The try{catch(Exception e) doen´t work.
I use System.Convert.ToInt32(string).
Thank you in advance,
Borja Riesgo Juan
|
|
|
|