|
OK so what you want to do is add a character to the selected position is the richtextbox and then save the data back to the file?
to insert into richtextbox...
RichTextBox1.Text.Insert(RichTextBox1.SelectionStart, ":)");
...you should also check the length of the current selection and remove that first if greater than 0
then you just save you text back to the file, which I will assume you can attempt as you have managed to read from the file
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hello Musefan
Thanks for your kind reply. but its not helping me.
Just to see what happens;I used this :
string str = RichTextBox1.Text;
int icurpos = RichTextBox1.SelectionStart;
RichTextBox1.Text = str.Insert(icurpos,"a");
and you suggested me :
RichTextBox1.Text.Insert(icurpos, "smile");
I don't think that there is any difference between above two code blocks. But still behavior is simply different. First one works but not second. I am new to C# and find myself unable to find out the reason.
Secondly when I use the first code block, after inserting desired character at the right place cursor moves to the first character in the rich edit control.
I hope I made my view very clear. Please give any suggestion to resolve the problem.
Thanks in advance.
Vishal Moharikar.
|
|
|
|
|
Sorry, bit wrong...
RichTextBox1.Text = RichTextBox1.Text.Insert(icurpos, "smile");
RichTextBox1.SelectionStart = icurpos + "smile".Length;
RichTextBox1.SelectionLength = 0;
...that should work better
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi Musefan,
Thanks a lot. I think you gave me enough solution.
Thanks once again and sorry for a late reply.
Thanks.
Vishal Moharikar
|
|
|
|
|
Hi folks,
some items in checkedlistbox for example the item will be like this (Kishore) kishore@gmail.com
i had a string kishore@gmail.com i have to compare this string with the item in checkedlistbox i have completed this but iam getting a error
"List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change."
Code:
if (checkedListBox_MailLst.Items.Count > 0)
foreach (string item in checkedListBox_MailLst.Items)
{
string mailItem=item;
checklistItem = mailItem.Split(' ');
foreach (string mailId in myMail)
{
if (checklistItem[2].ToString() == mailId)
if(checkedListBox_MailLst.Items.Contains
(mailItem))
{
int selectedItemIndex = checkedListBox_MailLst.Items.IndexOf(mailItem);
checkedListBox_MailLst.SetItemCheckState(selectedItemIndex, CheckState.Checked);
}
}
}
|
|
|
|
|
You can't modify what you're enumerating over. If you think about it, and the possible disasterous results if you could, it makes sense!.
What you can do is flag or store whatever needs modifying, and do the change afterwards. If you no longer need to keep testing, you can use break to exit imediately.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
0. Remove the email address from your example unless you really *like* special devices for the decerning gentleman.
1. Compare strings using string1.Equals(string2) , string1 == string2 is just comparing that the objects are the same (the same reference) not that the contents are the same.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hello all,
I am trying to develop an application which will record user login information in a database at the time any user logs into the system that is connected in a network (basically a LAN network, the information will be stored at the server).... his details like user name and login time will be fetched from registry details i suppose..... but i am not able to figure out a way of getting those events and locations in the registry using C#.net....... i believe i need to create a service application for this(as there won't be any interaction with the end-user) but i am quite new to these kinds of technologies........ For the past couple of days i have been searching on net for some articles related to design services and fetching such values in .net. but haven't got any simple documentation !!!!
Please help me with this in understanding the concept step by step as this is quite an urgency for me....... your help is heighly awaited
Thanks
Sujay
|
|
|
|
|
To create a service, just use the wizard of Visual Studio.
For example, you are creating MyService.exe. After compiling, you can install it using "installutil MyService.exe".
Then you can start/stop/restart it in service window. To uninstall it using "installutil /u MyService.exe".
To get user information, use : Environment.UserName
|
|
|
|
|
I have a .exe file which i need to run before my application got loaded,
So i am using Process class. Creating new process and running this exe and after this running my application.
I have few question :
a)Can we embed an .exe file in our Application(exe) file, and run that from inside? If yes, then how?
b)When we create setup project, there we specify "which files we put where", like in system folder, program folder etc. But i want to put a file inside driver folder present in system32 folder. how can we do this?
A detailed article would be great. I read/googled few article but they are not that in detail. Or i unable to search good one
c)How can we manipulate registry in setup projects, related to setup and deployements?
I am using vs2003, c#.
regards 
|
|
|
|
|
a) I fear there is not an easy way to do this. You can try to add the exe to the project as a biinary resource, then, at runtime, write it in a temporary folder and execute it using Process.Start.
b) In the File System Editor of your setup project, right-clicking on "File System on Target Machine", you can select Add Special Folder->System Folder.
c) Setup projects have a Registry Editor that can be used to write registry keys during setup.
|
|
|
|
|
Mirko1980 wrote: I fear there is not an easy way to do this. You can try to add the exe to the project as a biinary resource, then, at runtime, write it in a temporary folder and execute it using Process.Start.
Whats the use if i had to copy it temp folder, at present i am putting it inside setup and while installation it installed in program's folder. from there i am running it using Process. start, same?
Mirko1980 wrote: In the File System Editor of your setup project, right-clicking on "File System on Target Machine", you can select Add Special Folder->System Folder.
I am putting my files successfully up to here, but ii want to put inside driver folder which is present inside Environment.SysytemDirectory
any way to do this?
Mirko1980 wrote: Setup projects have a Registry Editor that can be used to write registry keys during setup.
Quote Selected Text
I know they have, what i want detail topic/article on it?
regards 
|
|
|
|
|
a) It's not the same, but you are doing it the right way. I tought you wanted to embed an existing executable into yours.
b) Just add a directory called driver under the System one. If this directory exists, the setup will copy filed into it.
c) Well is not difficult: you add keys and value in a tree view just like you do for the file system.
In any case, there is a Code Project article on how to create setups.
|
|
|
|
|
Just joking,
Are you planning to plant a virus??
|
|
|
|
|
Hi,
In Windows form when i say FormBorderStyle as None it is not showing it in task bar. How can show it in task bar?
|
|
|
|
|
Make sure in properties pallet for your Form ShowInTaskbar is set to true.
|
|
|
|
|
|
Wierd - it works for me. Search your project for ShowInTaskbar = false - it's possible that the setting in the designer file is being overridden elsewhere.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
There IS An Erorr
ManagementScope theScope = new ManagementScope("\\\\computerName\\root\\cimv2");
StringBuilder theQueryBuilder = new StringBuilder();
theQueryBuilder.Append("SELECT MACAddress FROM Win32_NetworkAdapter");
ObjectQuery theQuery = new ObjectQuery(theQueryBuilder.ToString());
ManagementObjectSearcher theSearcher = new ManagementObjectSearcher(theScope, theQuery);
ManagementObjectCollection theCollectionOfResults = theSearcher.Get();
foreach (ManagementObject theCurrentObject in theCollectionOfResults)
{
string macAdd = "MAC Address: " + theCurrentObject["MACAddress"].ToString();<-----------Erorr(Object Reference not set to an ...)
MessageBox.Show(macAdd);
}
What can I Do?
|
|
|
|
|
Hello.
Please keep the question to the original post, if you need to clarify something, respond to the person that posted it. You've posted this in the right place, and then posted it again. This is doubly bad.
Please also use descriptive subject lines, ""I Am Sorry To Ask Again" is not good subject lines. The reader should get an indication on your post by reading your subject line. It will help the right person answer your questions.
Now i'll answer this in the right place.
|
|
|
|
|
|
Sir,
I am once again typing the question by the help of example. I get data in datagridview only filter information. on filter information of datagridview, first colom is Emp id when i click on emp id the complete information show of the employee on next page datagridview.I hope its clear now
thanks
|
|
|
|
|
HI Experts,
I have used Picturebox to display my image....after my mouse over the image i want the information of that picture to b displayed.......
Thanks in adv.
|
|
|
|
|
Take a look at How To Add ToolTips To Controls On A Windows Form[^]. If that does not help you, please come back with specific questions.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks It Helped Me 
|
|
|
|