|
Set the property PasswordChar of a textBox.
TextBox1.PasswordChar = "*"; Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
As Abhinav says, use TextBox.PasswordChar, or you can just set TextBox.UseSystemPasswordChar = true[^] to use the system "blob" character.
[edit]Corrected spelling of Abhinav - sorry![/edit]If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
modified on Monday, February 15, 2010 10:00 AM
|
|
|
|
|
OriginalGriff wrote: [edit]Corrected spelling of Abhinav - sorry![/edit]
Thanks.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
i want to show what my webcam is "seeing" in a picture box so how can i do this?
|
|
|
|
|
|
the file didn't open... i'm using visual studio 2005
|
|
|
|
|
If you download project , you can see CaptureNET - capturing test .
CaptureNET need DShowNET.dll.
And there are have DShowNET project for dll.
All projects written under Visual Studio 2005 - C# language .
Try one more time!If you have visual studio , files need open.
Good luck. We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
Hi everyone. I'm a newbie to C# and I'm having trouble with the following -- I'd like to know whether it's possible, or learn some alternative way of doing it:
I'm writing a system that underlies applications and manages access to shared data to ensure concurrent accesses don't end up making a mess. Basically, I'd like application programmers to be able to write their code as they normally would, without worrying about concurrence, and then simply tag their methods with [Atomic] if they want the system to treat them as such. Now, my question isn't how to make the methods be atomic -- I have already implemented all that. What I want to know is how I can control access to the fields of atomic objects. I'll explain.
Say they define following class:
class MyClass {
private int x;
private int y;
public void doStuff() {
x = y + 10;
}
}
I don't want them to access x and y like that. What I want to do use ILGenerator to create an extended version of MyClass in which I handle the access to fields safely:
* I modify the names of the fields to FORBIDDEN_x and FORBIDDEN_y .
* I define properties x and y (i.e., with the old name of the fields), so that where the application programmer used to directly access a field, he will now access the corresponding property.
* I define the methods get and set of each property so that they handle the accesses safely.
So, once again (sorry for the insistence):
* I want the programmer to be able to write their code as seen above, with unsafe access to fields.
* I then want to go and hack the names of the fields and add properties so that I can handle the access safely.
This way the programmer doesn't need to make any special effort in their code, because I'll hack it later.
And now for the problem: I cannot change the name of the fields. It's read-only.
So, is there any way in which I can do this, or something similar, so that the programmer still has the illusion that he's accessing the fields directly? The only thing I can think of is that the programmer defines the properties himself like so:
class MyClass {
private int x;
private int y;
public int xProp {
get { return x; }
set { this.x = value; }
}
public int yProp {
get { return y; }
set { this.y = value; }
}
public void doStuff() {
xProp = yProp + 10;
}
}
and then I'll go in and hack xProp and yProp 's get and set methods, but now the programmer has to make the extra effort to define the properties and to never forget to use them instead of the fields. Is there any way I can achieve what I originally intented to do?modified on Monday, February 22, 2010 9:23 AM
|
|
|
|
|
Hi,
1.
public int x {get; set;}
is all it takes to have an "automatic value-with-property".
2.
IMO if you insert locks automatically, rather than having the programmer design and code for parallelism, one of two things will happen:
- either your locks are at too low a level and don't offer any real protection;
- or a typical multi-threaded app will dead-lock right away.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Luc Pattyn wrote: is all it takes to have an "automatic value-with-property".
Ooh, great. It was a newbie question . That's great news for me!
Luc Pattyn wrote: IMO if you insert locks automatically, rather than having the programmer design and code for parallelism, one of two things will happen:
- either your locks are at too low a level and don't offer any real protection;
- or a typical multi-threaded app will dead-lock right away.
I don't insert locks . I'm translating a transactional memory system that has proven to perform very well with different workloads. The appeal of transactional memory is that you get a scalability that's comparable to that of fine-grain locking (depending on the transactional memory system, of course) and none of the headaches. Plus no deadlocks or livelocks.
Thanks a lot for your answer, this is was a really important point.
|
|
|
|
|
I didn't have time to try your suggestion until now, but now that have I've run into some serious issues. If anyone can give me some insight I'd really appreciate it. I explain the problems I've encountered with each approach I've tried:
1) I tried doing as you suggested and having the programmer use auto-implemented properties, like this:
public int x {get; set;}
But then I have found no way to dynamically modify the accessors' code, which was the whole point. The only thing I can do is get the MethodInfo of the accessor, but as far as I can see there is no way to get a MethodBuilder from that, so I can't modify anything. Is there something I'm missing?
2) I tried not having the programmer use auto-implemented properties and just define the fields like this:
private int x;
And then I went in and tried to add a property with the same name as the field (x ), to do as if the programmer had declared the field+property like this:
public int x {get; set;}
And then work from there, this time having the MethodBuilder and being able to work with the code.
Of course, this doesn't work. The surprising thing is I don't get an exception when add the property, despite the fact that I'm declaring two symbols (the field and the property) with the exact same name in the same namespace. I don't know how that's possible, and if I do that by hand (i.e., writing the following code) I get a compiler error, as would be expected.
private int x;
public int x {get; set;}
If I add it dynamically (with DefineProperty) it simply doesn't seem to have any effect.
Ideally this would be the solution I'd like to use, as it requires no effort from the programmer, but I don't see how I can get this to work.
The thing is I need the programmer to be able to write their code normally, and then I'll fix the accessors so that it's safe. For them to able to write normally, I need to create properties that have the same name as the fields they declared, or have them declare automatic properties and then somehow I'll add code to the accessors.
This is crucial for my project. Is it possible at all?
Thanks a lot.
|
|
|
|
|
blackblizzard wrote: Is it possible at all?
I don't know the answer to your fundamental question.
I can tell you the compiler generates some code for auto-properties, which Reflector decompiles like so:
[CompilerGenerated]
public void set_x(int value)
{
this.<x>k__BackingField = value;
}
[CompilerGenerated]
public int get_x()
{
return this.<x>k__BackingField;
}
where the backing variable has an identifier that would be invalid when entered in the source code. Not sure whether reflection code would accept such identifier...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Thanks, I'll check it out. In the meantime, I've found that if the programmer declares the properties as virtual I can overwrite them (kinda obvious, but I had about the virtual/non-virtual issue). So solution 1) works (even though I like solution 2) better). However, I'm testing it and it only seems to work when they're declared as public, but not when they're protected: I've overwritten the accessors get and set so that they print "read access" or "write access" respectively, but this only works when the property is declared as follows:
virtual public int x {get; set;}
If instead it's declared like this...
virtual protected int x {get; set;}
...I don't get any messages. Do you know why?
Thanks!
|
|
|
|
|
|
Hi ,
I have a datagridview(dgv) populating data from the database. The dgv also has a checkbox column to select rows and the form has a update button to update the selected rows.
I want to change the dgv column to a combobox column to allow the users to select from the dropdown and update the value of the column. How can i achieve this,,
I hope this makes sense.
Thanks,.
|
|
|
|
|
This[^] might be of some assistance.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Thanks for it,
But i would like to convert the dgv column into combobox column when the checkbox is checked for a particular row. (C# Please)
how to convert dgv column to dgv combobox column which shows the drplist items as in the table.
|
|
|
|
|
spankyleo123 wrote: convert the dgv column into combobox column
As a thought, will setting the visibility help you out?
You cannot convert a column into a combobox - you can show and hide different user controls.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
yeah i tried something like this
dgv.Columns[6].Visible = false;<br />
testComboColumn.Visible = true;<br />
testComboColumn.DataSource = tmx.tbTest;<br />
testComboColumn.DisplayMember = "Text";<br />
testComboColumn.ValueMember = "ID";<br />
is it possible to show the combobox list only for the select row?
|
|
|
|
|
AFAIK, you should be creating separate instances of the combobox, one for each row of your datagridview.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Hi,
I am developing an application in ASP.NET 2008. In this application i need to print various reports. Some reports need to be printed in customized paper also. For this purpose i am searching for best searching solution of printing reports.
I have more idea in printing in Crystal Report. I know some about JavaScript printing also. Here i have found using Crystal Report is easy for me. But i don't know if i use Crystal Report in my application it affects in performance or not. Which is best printing technique for web application.
Please reply me with some ideas and source codes.
Reply me.
|
|
|
|
|
sharad Pyakurel wrote: I am developing an application in ASP.NET
Well would it not have been better to post your query in the ASP.Net forum?
sharad Pyakurel wrote: Which is best printing technique for web application
Many sites render a page to a PDF document so users can save easily.
sharad Pyakurel wrote: and source codes
You won't get folk on here handing out source code.
|
|
|
|
|
Hi.
I have problem with process exit.
I'm using this code :
Process proc = new Process();
proc.StartInfo.FileName = str;
proc.Start();
proc.WaitForExit();
DoSomeThings();
This code sometimes not working.
For example ,I have opening Visual Studio. I want run process *.cs or *.cpp (Visual studio files) files. That files opened last Visual Studio.After that i don't know my process running or exited.
And i get InvalidOperationException.
How i can know my process running or exited?
Please help me.
Thanks,
Nematjon.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
from MSDN: "Process.Start() returns true if a process resource is started; false if no new process resource is started (for example, if an existing process is reused)."
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi Luc.
Thanks for you reply.
I think you don't understand me(soory , my english skils not so good ).
My process started, but i want to know when process exited?
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|