|
I'm having difficulty adding hidden text to a RichTextBox. See case2 below.
Case1:
Initialize Form1 in Main(string[] args){}.
In Form1, initialize a RichTextBox as follows:
RichTextBox rtb = new RichTextBox();
Observe that rtb.SelectedRtf is initially set to "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033\\uc1 }\r\n";
Now try:
rtb.SelectedRtf = @"{\rtf1\ansi " + "visibleText" + @"\v " + "hiddenText" + @"\v0}";
result:
rtb.Text = "visibleTexthiddenText" as expected.
Case2:
Form1 is initialized as an MDIChild Form:
Again in Form1, initialize a RichTextBox as follows:
RichTextBox rtb = new RichTextBox();
This time rtb.SelectedRtf is initially set to empty string.
Try:
rtb.SelectedRtf = @"{\rtf1\ansi " + "visibleText" + @"\v " + "hiddenText" + @"\v0}";
result:
rtb.Text = "visibleText"
i.e. the hidden text is not being updated when Form1 is an MDIChild.
Anyone know the cause/walkaround? Your help is appreciated.
Thanks, B
|
|
|
|
|
I am facing the same issue. Its been 5 years since you have asked this question. Did you get the solution ? If so, please share with me.
|
|
|
|
|
As I recall an external component was loading a different version of the riched32.dll/riched20dll. Workaround was to initialize the right dll first (new RichTextBox() in your application).
Hope this helps.
|
|
|
|
|
Thank you very much for responding. I will give a try. Thanks again !
|
|
|
|
|
Hello,
I have an application names "Control Center". In this application i have implemented
Socket Server. I starts any number of .exe of my other application through process start.
And in that application i have implemented Socket client.
Now, i want suggestion that,
1.Is it good to communicate clients and server on single port?.
2. Is it harmfull to keep socket connection open continuously?.
3.If, i keep socket connection open continuously will it work properly?.
Please guide me.
Thanks In Advance.
Rahul Kulkarni
|
|
|
|
|
hi all
my requirement is like this on updation of table on the webserver an event should rise and let someone on the server should knwo that.....
i want a good site where i can get info. relating this or any suggestions how to do this....
how can i catcht the event tat is rised in sql server .... in vs 2005
thank you in advance
byebye
|
|
|
|
|
If you perform an update, you can catch this with a trigger. How you want to proceed beyond this, is entirely up to you, but I would start with defining a trigger.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I want to know how to reduce the color depth of a Bit Map Image in c#.
Then the resolution will be less at the same time the capacity of the image also will be reduced.
Then it is easy to send the image throght network due to the low capacity.
Hope thee will be some one who can give me a clue.
Thank You
NRKumudunee
|
|
|
|
|
Hi, I have a web method that is very chatty, here is sample output from it;
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<types:MyWebMethodResponse>
<MyWebMethodResult href="#id1"/>
</types:MyWebMethodResponse>
<soapenc:Array soapenc:arrayType="types:MyType[1]" id="id1">
<Item href="#id2"/>
</soapenc:Array>
<types:MyType id="id2" xsi:type="types:MyType">
<Id xsi:type="xsd:string">someid</Id>
<Number xsi:type="xsd:string">Number 1</Number>
<Title xsi:type="xsd:string">Title</Title>
<Addr xsi:type="xsd:string">some address</Addr>
<City xsi:type="xsd:string">some city</City>
<State xsi:type="xsd:string">some state</State>
<Zip xsi:type="xsd:string">11111</Zip>
<Times href="#id3"/>
</types:MyType>
<soapenc:Array soapenc:arrayType="types:Time[256]" id="id3">
<Item href="#id5"/>
<Item href="#id6"/>
<Item href="#id7"/>
<Item href="#id8"/>
<Item href="#id9"/>
...
<Item href="#id258"/>
<Item href="#id259"/>
<Item href="#id260"/>
</soapenc:Array>
<types:Time id="id5" xsi:type="types:Time">
<StartTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</StartTime>
<EndTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</EndTime>
</types:Time>
<types:Time id="id260" xsi:type="types:Time">
<StartTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</StartTime>
<EndTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</EndTime>
</types:Time>
</soap:Body>
</soap:Envelope>
All of those <Item href...> take up a lot of space, is there a way instruct .net not generate it?
This is the declaration over the webservice C# class file;
[WebService(Namespace=Constants.NAMESPACE), ToolboxItem(false), SoapRpcService]
The web method just has plain, [WebMethod] attribute and that's it.
Thanks,
|
|
|
|
|
I had posted this question two weeks back but till date no one has responed. Is this indeed an issue with the combobox? I hope I'm clear with my question and this time I will get some help from this forum.
ComboBox control has got selectedindexchanged event. As the name suggest this event should fire when selected item change for the combobox. But this event fires even when the currently selected item is selected again from the dropdown list of combobox.
e.g.
if I have loaded following items in my combobox say
item1
item2
item3
item4
with item1 as selected when my application starts.
Now if from UI, I again select the "item1" (which is already selected in combo box) then also the selectedindexchanged event fires. In this case the index has not changed still the selectedindexchanged event fires. I find this bit strange.
Is there anyway to findout when the selected item has changed by User. I want some kind of notification when user indeed changes the combobox selected item (not when combobox.selecteditem is set through code)?
regards
KC
|
|
|
|
|
You have to store your selected index, and compare it to what is in the control after the event fires. The event should check first, then store the value for next time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian
Thanks for your reply. I agree to your solution where I have to remember the previously selected index and match it with the newly selected index in the eventhandler. If new and previous indexes are same then skip the execution of handler. But this is not going to serve my purpose.
What I want is, I want to skip the execution of ComboboxSelectedIndexChanged Eventhandler when the already selected item in the combobox is again selected by user (i.e. user clicks the combobox and select the same item again). I don't mind if combobox SelectedIndex changed event fires through some code i.e. ComboBox.SelectedIndex = 2;
So in nutshell want to restrict the eventhandler when same item is selected through user interaction.
|
|
|
|
|
Well, you plainly can't stop the event from firing. Until it fires, you can't make your code run at all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You could combine it with TextChanged event
|
|
|
|
|
Try overriding the combobox control. Very, very basic example below;
class ComboBoxWidget: System.Windows.Forms.ComboBox
{
#region private member variables
private int _selectedIndex = -1;
#endregion
#region overrides
protected override void OnSelectedIndexChanged( EventArgs e )
{
if( this.SelectedIndex != this._selectedIndex )
{
this._selectedIndex = this.SelectedIndex;
base.OnSelectedIndexChanged( e );
}
}
public override int SelectedIndex
{
get
{
return base.SelectedIndex;
}
set
{
this._selectedIndex = value;
base.SelectedIndex = this._selectedIndex;
}
}
#endregion
}
|
|
|
|
|
How to call .mht files in C# project?
|
|
|
|
|
What is an mht file ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
In Visual Studio Team System, the manual test case is saved as .mht file. Manual tests are nothing more than a .mht file that has been added to your project, when you create a Manual Test.
|
|
|
|
|
using System.Diagnostics
Process.Start("notepad","D:\\somefile.txt");
this works, though there is probably a better way to do it
|
|
|
|
|
I have a simple C# application with an embedded Internet Explorer Active X component for quickly displaying and printing HTML pages. This application is not seen by PC Anywhere. If this application is active on the screen it will show the background of the host and part of the screen will be inaccessable by the remote computer. Has anyone else seen this or better have a fix for it?
Thanks,
Darrell
|
|
|
|
|
Any form that has any sort of transparency, is not visible over a remote connection. Is that the problem ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Remote desktop doesn't support directx
|
|
|
|
|
I need some help with being able to open a document that is listed in a datatable and is displayed in a datagridview. The code below returns a series of results from a database and these results include the file paths of files on my computer. What I want to be able to do is doulble click on a particular file path in the link column and have that file open.
Hits hits = searcher.Search(query);
DataTable dt = new DataTable();
dt.Columns.Add("link", typeof(string));
for (int j = 0; j < hits.Length(); j++)
{
Document doc = hits.Doc(j);
DataRow row = dt.NewRow();
row["link"] = doc.Get("link");
dt.Rows.Add(row);
}
MessageBox.Show("Search Complete", "", MessageBoxButtons.OK);
return dt;
|
|
|
|
|
I have solved the problem, just in case anyone is interested.
private void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
SearchIndex search = new SearchIndex();
search.docOpen(this.dgv.CurrentCell.Value.ToString());
}
public void docOpen(string path)
{
Process proc = new Process();
proc.StartInfo.FileName = "iexplore";
proc.StartInfo.Arguments = path;
proc.Start();
}
|
|
|
|
|
This problem has to do with updating a control/dataset based on the DataRecevied event of the serial port. Now I know you are thinking cross threading (which it might be) but let me explain.
I have a dataset in the main UI form that is databound to a number of controls. When I change the values of the dataset the bound controls update. This is fine, but when I update the values of the dataset via the DataReceived event the values DON'T update? To illlustrate the problem simply I have stripped down the code to it's most basic form. I hope someone can shed some light on the problem.
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
UnitDataSet uds = new UnitDataSet();<br />
uds.DIns.ReadXml("Data.xml");<br />
<br />
_comms = new Comms(uds);<br />
<br />
Label lblInputState = new Label();<br />
panel1.Controls.Add(lblInputState);<br />
<br />
lblInputState.DataBindings.Add("Text", uds.Tables["DIns"], "state");<br />
}<br />
<br />
public void button1_Click(object sender, EventArgs e)<br />
{<br />
_comms.ChangeValue();<br />
}<br />
}<br />
<br />
============================================================<br />
<br />
class Comms<br />
{<br />
SerialPort _sp;<br />
UnitDataSet _uds;<br />
<br />
public Comms(UnitDataSet uds)<br />
{<br />
_uds = uds;<br />
_sp = new SerialPort("COM7", 9600, Parity.None, 8, StopBits.One);<br />
_sp.DataReceived += new SerialDataReceivedEventHandler(_sp_DataReceived);<br />
_sp.Open();<br />
}<br />
<br />
private void _sp_DataReceived(object sender, SerialDataReceivedEventArgs e)<br />
{<br />
ChangeValue();<br />
}<br />
<br />
public void ChangeValue()<br />
{<br />
bool tmp = (bool)_uds.Tables["DIns"].Rows[0]["state"];<br />
_uds.Tables["DIns"].Rows[0]["state"] = !tmp;<br />
}<br />
}<br />
Visual C# Express 2005
|
|
|
|