|
I have load an image to a picture box like here:
MypicBox.Image=Image.FileName("D/foto1.jpeg")
the pic is now displaying in the box, but how can I clear it now?
thanks
|
|
|
|
|
with the magical line
MypicBox.Image=null;
|
|
|
|
|
|
MypicBox.Image=null
Is it right ?
imagic
|
|
|
|
|
insert the default image to the picturebox or zero it :
pictureBox01.Image = null;
|
|
|
|
|
Hai all I have a problem related to changing the color of text in a rich text box.What I want to do is lets say I have 10 lines of text in the rich text box.I want to change the color (highlight) the color of text from line no 3 to 7.
Pls help.
|
|
|
|
|
Selecting the text you want colored, then setting myRTB.SelectionColor should do it.
|
|
|
|
|
Thanks dear
But the problem is how to select the text.
Ex: I want to display the text like this
for (int i=0; i<10; i++) {
console.WriteLine("Hello world\n");
console.WriteLine("I'm here\n");
}
and I want to color the for statement only.How can I
select the text releted to for statement without statements
inside the for loop.
Plaese help.
|
|
|
|
|
hi ...
i exactly can not understand what do you want ...
but for select a text in rich text box and change it's color you can write follow code ...
richTextBox.Text = "test";
richTextBox.Select(2, 2);
richTextBox.SelectionColor = Color.Blue;
|
|
|
|
|
Hi,
the easiest way is to color the text while adding it to the RTB:
int start=rtb.SelectionStart;
rtb.Add("some text");
int end=rtb.SelectionStart;
rtb.Select(start, end-start);
rtb.SelectionColor=color;
If that is not possible, you must somehow parse the existing text to find
the piece you want colored (e.g. by locating/counting the newlines).
|
|
|
|
|
Thank alot for u're help.
But the problem is not solved totally.
The number of characters which change the color is not static for everytime.
It changes time to time.
So can U pls tell me how to color the text from (2 , to the end of the text)
Thanks again dear.
|
|
|
|
|
study the example I gave you, it contains it all.
|
|
|
|
|
how can i invoke application from my windows service in windows 2003 server. in xp i have done it.
|
|
|
|
|
Check out the Process class. This class can be used to start other applications:
Process class (System.Diagnostics)[^]
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
I created an installer project for my C# windows forms app, but it won't overwrite previous versions of the program. The users have to go to their Add/Remove Programs, and uninstall it there, then the new installer will run. I can't find anything about this on Google or in the MSDN. I found reference to a property of OverwritePreviousVersion, but I can't find it in my project anywhere? I've looked through all the properties windows of the application, and of the installer project...
Where do I set this option? I just need it to overwrite the EXE file really... the rest of the stuff can stay... well I'd need to update the shortcuts in the programs menu too I think...
|
|
|
|
|
So you just need to overwrite the previous installed versions while installing ?
In that case, just check the properties of the installer project. In the property window, you will find an attribute - 'RemovePreviousVersions'. Set it to "true"(sorry for previous mistake, just set it to true) and i hope it will work.
btw, thanks for your reply to my post.
Chayan
|
|
|
|
|
There is no such thing on my project. That is what I'm saying... I could send screen shots... I have no idea what I'm looking at. I've read the articles that talk about that property, but I can't find it on any of the screens in my Visual Studio. I know it sounds stupid, but it's just not there?!
|
|
|
|
|
So you are in a strange situation. This option may vary from version to version. I am not sure. I use visual studio 2005. I don't know about other versions..
One more thing, i know you have already checked everywhere for this option. So it's silly to say it again. But still, just to make sure, there are 2 property pages. One if you right click on the SetUp project and click on property. Then you'll see a property page but you can't find it there. But if you just select the setup project, then in the property tab, you should find it. But i know, you must have checked it and can't find it. So I don't know what can be the solution. Hope that, someone else can help you.
Regards
Chayan
|
|
|
|
|
Iftekhar Naim wrote: just select the setup project, then in the property tab, you should find it
OMG! Thank you! I will sooo buy you coffee if I ever see you
|
|
|
|
|
You are welcome. and thanks for your offer of coffee . let me be optimistic..
Chayan
|
|
|
|
|
Hehe... that's just me. I'm a real bitch online sometimes but I'm actually a friendly and generous person - I'll buy coffee for anyone, maybe even dinner. In my world, I don't meet people in person too often, so it's a nice treat when I get to do that.
|
|
|
|
|
I have developed a .Net application. But sometimes it faces some problem during uninstall. For example, if i manually delete the folders, without uninstalling it, i can not re-install it. Then i have to manually delete entries from registry by searching.
I thought that i will delete registry entries automatically with a program and with the some help from the members of this forum, i developed it. Now i am facing 2 main problems-
1. Sometimes, even after deleting all the entries from registry(except those legacy, that can not be deleted), still i can not reinstall my application. It's quite strange. It has no registry entries(except few that can not be deleted) and nothing in C drive. But still when i try to install it again, it says - "Previous version still exists". Can anyone tell me, how can it be existing when i deleted every thing from my PC and registry ?
2. While my program deletes entries from registry, it also deletes some other entries that should not be deleted and makes my system unstable. Is there any specification that, i need to delete only these keys and values. I saw in few software specification, they say to delete only from "LocalMachine\Software\" and 1 or 2 other place.
Sorry for so long message. But i am really confused and need to solve this problem. CodeProject has always been the best source of help for me. Hope i will get some help this time too.
thanks
Chayan
|
|
|
|
|
That's one reason I'm using .Net settings and staying away from the registry.
http://msdn2.microsoft.com/en-us/library/aa730869(vs.80).aspx[^]
Sounds like you aren't being accurate with your registry key names. Sorry I can't help more, but if you're just saving preferences or data, the new type of settings file would work well.
|
|
|
|
|
thanks for your reply. But i am not setting any settings value in registry. They might be automatically stored, when i install the software.
One more thing, even after manually removing all registry entries, i can not re-install the software again. it still says - another version already exists...
Please, give some more details..
thanks
Chayan
|
|
|
|
|
Hi everyone, this was an email to a friend that doesn't seem to be around.. perhaps you guys can help me out here ? I hope the examples I provided are clear enough. I'm having a bit of a problem grapsing the exact concept of what I need to do. An example or point to a good resource would be fantastic!! Thank you all in advance:
---------------------------
public class tbl_someTable {
private string field1;
private string field2;
public string Field1 {
get { return field1; }
set { _field1 = value; }
}
public string Field2 {
get { return field2; }
set { field2 = value; }
}
}
So above is a class, representing a table in my database. Now, think ‘big’ and there are several of these, covering all sorts of tables. Now, I want a ‘storage’ class, which stores information about something that’s currently going on. I create that object, and have it wired with change events..
public partial class StateObject {
[event declarations for an “onStateObjectChanged” event]
private tbl_someTable _someTable;
public tbl_someTable someTable {
get { return _someTable; }
set {
_someTable = value;
onStateObjectChanged(this,new StateObjectEventArgs(“someTable”));
}
}
}
Now, the above works GREAT !!! In usage :
…
StateObject stateObject = new StateObject();
stateObject.StateObjectChanged += delegate ( object S, StateObjectEventArgs E) {
MessageBox.Show(“Called. – “ + E.TableThatCalledMe);
};
stateObject.someTable = new tbl_someTable();
stateObject.someTable.Field1 = “Hello”;
stateObject.someTable.Field2 = “World”;
…
The above, would generate two events! That’s ok, still not optimal.. but whatever. At least I know something changed! I might not want to know that those two fields changed, but what can I do ?
-- NOW – The problem.
public partial class StateObject {
private List<tbl_someothertable> _someOtherTable = new List<tbl_someothertable>();
public List<tbl_someothertable> someOtherTable {
// Get / Set accessors
// No way to fire them!!!
}
}
…
tbl_someOtherTable x = new tbl_someOtherTable();
x.name = "Test 1";
stateObject.someOtherTable.Add(x); // as an example
x = new tbl_someOtherTable();
x.name = "Tets 2";
stateObject.someOtherTable.Add(x);
…
I would get no notifications!
I understand that perhaps I should be using the Collection<t> class instead, because I can override the add/remove/etc. events ? – well, I don’t know how to do that, or implement it in StateObject properly ?
I realize, I’ll probably have to create another class, that inherits from tbl_someOtherTable and implements ICollection<t> ? Then I can get notifications and such, but I’m not sure how to wire them into the original class ? – or just subscribe to them in a constructor or something, and make it fire the main [StateObject] event that notifies other things ? What I really need is an example that doesn’t confuse me! I think I have a pretty good grasp on this… but I’m just not quite there. I need to store a list of objects [think, items in a cart!] and be able to access them easily!
Thank you !
-- modified at 22:16 Saturday 23rd June, 2007
- Matthew
|
|
|
|