|
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
|
|
|
|
|
I need to develop a client-server socket application, where the client will simply send data to a port(No specified IP will be said, may be IPAddress.Any). And the server will grab data from that IP Address and port(So server socket will bind to a specific IP ) and insert the data to database.
This seemed a bit conflicting to normal client-server idea to me and I have developed it the other way(like normally, clients send to the specific IP (of server) and port, and server just listens to a specific port from IPAddress.Any).But now i am instructed to do it reversely as i said above. Can any one tell me how can i do it?
I tried to create a client socket that will send data to IPAddress.Any and a specific port. It gave me exception -
"Only one usage of each socket address (protocol/network address/port) is
normally permitted."
Chayan
|
|
|
|
|
I made a library and used it in an application. But when I moved the application to another directory, one of those windows with the "Send Error Report To Microsoft" thing popped up. So I moved the library to the same directory as the application and it worked fine. Why can't they be in different places?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Fundamental design feature of .NET, an assembly looks for references in two locations, firstly it's own directory tree (i.e. the same directory and sub-directories of the directory which the executable is in (hope that makes sense)) and also the GAC. By moving the library away from the application's directory hierarchy the CLR is unable to locate it.
|
|
|
|
|
I guess the real question is, why did you expect it to be otherwise ? .NET assemblies are not registered like COM dlls are, and the system is not going to search the whole HDD for your file. If it did, what would it do if it found more than one of the same name.
As someone else said, the 'new' feature of .NET is to discard the idea of central registry and go back to having all the files local, so each exe has it's own copies of the libraries it needs.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi..
I am making a VS.Net2003 windows application.Iam trying to create a typed dataset without using the usual way (Data menu>generate dataset) because I don't want to create the dataset and fill it in the Form class.So I have added a new dataset visually (Right click the project then Add New Item then choosing DataSet) but when I drag the table to the designer panel of the DataSet XSD file the schema of the table appears but I didn't find any adapters generated.Then I created a SQLDataAdapter to fill the typed dataset and then give it to the datagrid as a datasource but nothing appeared in the datagrid.Iam trying to display 2 columns in the datagrid using DataGridTableStyle(DataGridBoolColumn and DataGridTextBoxColumn).I hope that you can help me to solve this problem.
I am too late but i will never give up
|
|
|
|
|
VS2003 doesn't generate table adapters for your dataset. The only way to get one generated for a specific table, is to create a new component. After you created the component, you need to show the designer of the component and drag-and-drop a data adapter onto the designer. Now you can configure it using the contextmenu.
Of course you can move over to VS2005 or C# 2005 Express edition. This contains the functionality you need and many other things that could make your life easier. However it depends on the requirements you have for the application if changing to C# 2005 is an option.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Thank you very much.I tried it as you told me and it works.I tried to use the same code that was added automatically to fill the dataset from a separated class but it didn't work and I dont know how to save changes in the datagrid to the database because I didn't add an object of the dataset to the designer using the code (adapter1.update(dataset1))?
I am too late but i will never give up
|
|
|
|
|
Hi ,
I want to add a new user account to windows using C#, its a stand alone pc , not on domain , no AD. I found some examples on internet , which uses "Netapi32.dll" , and its not working for me. I cant seem to get error code that why its failing !!!
Is there any .NET API to add user ?
Or any working example of using Netapi32.dll API ?
Thankz
ZINK
|
|
|
|