|
Irfan Faruki wrote: Should i be using a Textbox or a Richtext control
Depends on how do you want to look and function your notepad
Irfan Faruki wrote: How do i go about replicating Find & Replace function
string objects have several functions that you might consider interesting:
- IndexOf - returns an integer greater or equal to 0 if what you seek is in the string, or it returns -1 otherwise
- Replace - replaces a part of a string with a new string (don't have to be the same length)
Irfan Faruki wrote: How do i go about replicating Go To function of notepad
if you use a textbox there is the Lines property which is a string array so you read the line number from the user and pass it as an indexer in that array.
Hope it helps you. Good luck
Do your best to be the best
|
|
|
|
|
Thanks a lot for your reply. I will give it a try and post back if i have problems
I am still learning
|
|
|
|
|
You know how each MSN messenger emoticon actually represents some text? Ok, to clarify, I made a simple form with 2 richtext boxes and 1 button which does the following:
<br />
private void btn_Ok_Click(object sender, EventArgs e)<br />
{<br />
DataFormats.Format MyFormat = DataFormats.GetFormat(DataFormats.Bitmap);<br />
DataFormats.Format MyFormat2 = DataFormats.GetFormat(DataFormats.Text);<br />
richTextBox1.Paste(MyFormat);<br />
richTextBox2.Paste(MyFormat2);<br />
}
First, I copy an image from say a word document. When I click on my button, the image appears in richTextBox1 but nothing appears in richTextBox2. However, if I copy a MSN Messenger emoticon, the emoticon picture appears in richTextBox1 and the corresponding text appears in richTextBox2.
Now my question is: So HOW do I embed that text into an image (like an emoticon) in the first place? Because obviously the emoticon has something more than a regular image.
|
|
|
|
|
Do you mean when you type " " and it replaces it with an image? Just parse the text then replace the substring " " with ""
|
|
|
|
|
Thanks but that's the problem i encountered. See, when a text is replaced with an image, the text is "lost". So say I have the string "Smile :p and cry . I can exchange the text for pic fine. The problem is when i want to "copy" this string onto another window without losing the text part. In the example above, i can only copy the picture or the text but not both. So i wondered how messenger is able to retain the text part in the image. Does it store a copy of the original text string in the background? But with this approach what happens when you delete a picture? How would the original string know what word you deleted?
|
|
|
|
|
Hi,
can any one help me in findout how to set validation for double field in property grid.
eg.
[Description("vet contain x"),Category("Vet")]
public double X { get { return FX; } set { FX = value; } }
here how can i set the max value for 'FX' which is double.
|
|
|
|
|
|
Hi,
I have problem with reading from serial port.
Even though the port is connected and a thumb impression is given as input
my program couldnt read. It produces System.TimeOutexception in the line
of code where i read from port. I couldnt get any idea how to get rid
form that.
The following is my code.please guide me whati have to change to get
the output.
If serialPort.IsOpen Then
serialPort.Close()
End If
Try
With serialPort
.PortName = ComboBox1.Text
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
End With
serialPort.Open()
MsgBox("SELECTED PORT IS CONNECTED")
Dim bufferpic As Byte = CType(serialPort.ReadLine, Byte)
Dim MemstrmPic As New IO.MemoryStream(bufferpic)
Form1.PictureBox1.Image = Image.FromStream(MemstrmPic)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Thanks in advance
|
|
|
|
|
I can open an excel woorkbook and select the sheet that i want to work with. After i have populated the sheet with data from a web front end i wish to display all the new data in a table on a webpage. I know in what range the data is on the worksheet but im having trouble writing it to the table. Can anyone point me in a right direction please ??
some code ...
Excel._Worksheet objSheet;
Excel.Sheets objSheets;
public void PopulateTable() {
objSheets = (Microsoft.Office.Interop.Excel.Sheets)Session["ExcelSheets"];
objSheet = (_Worksheet)objSheets.get_Item(3); /// 3rd worksheet in the workbook
Range PrintQuoteRange = objSheet.get_Range("A1", "E68"); //data from cell A1:E1 to A68:E68
//// display rows, col and cells in a table
//// ?????
}
|
|
|
|
|
You're on the right way
With this range you may fill a multidimensional array and put it into a table.
Just use the .get_Value() method of the range object to retrieve this array.
<br />
string [,] mydata = PrintQuoteRange.get_Value(System.Type.Missing);<br />
Now you have the whole Data in the array. A simple for loop will do the rest
Tell me if you keep having trouble with getting the data into a table.
I had to do something similar just 2 weeks ago and found this article very useful:
How to automate Excel by using Visual C# to fill or to obtain data in a range by using arrays
ATTENTION: if you want to set a value of a cell to more than 911 characters, you will get a com exception. To work around this issue just use the querytable instead (have a look at the COM forumpost i made recently)
However, good luck with automating Excel
(Let me know if you are not able to kill the excel process properly - i just found a nice article to get rid of this too )
|
|
|
|
|
Thanks alot! It worked 100% .... but it looks a bit tacky.
I wanted it to look just like the format in Excel. So i went back to the drawing board for a new solution i want to share just incase someone else does it too.
I copied the Excel sheet area i wanted to use and pasted it right in a new webform design view and saved it as Template.aspx . It looks exactly like the format in the excel sheet.
Now the for cells i want to populate, i just name then with html tags. I then use a normal streamreader to read the Template.aspx file and use my session variables to change the tags to the values i want ...... and viola !
Thanks again for the table solution above, atleast it worked too. 
|
|
|
|
|
hi .
I want to know how can get clicked link in IE or other browser with c#.net .(I want arived url of a link with click on it)
computer
|
|
|
|
|
Hi,
Actually what you want to do?
If i am not getting you wrong, you want to hyperlink to some URL on click?
<marquee>nishu
|
|
|
|
|
Hi,
I am looking for a way to change the default WindowClassName of a .NET form into a custom one.
The default WindowClassName is .NET is: (VS.NET 2005/.NET 2.0)
WindowsForms10.Window.8.app.0.3ce0bb8
The reason is that I want to use FindWindow with a my unique class name, and currently I am forced to find the window by window title (very fragile solution).
In C++ it was very easy, but in .NET it seems to be deeply hidden in Windows Forms.
Anyone has a good hack/solution to this problem?
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Hi,
I'm not entirely sure if this is what you're asking, but I find individual open forms in my application using this code block:
foreach (Form frm in Application.OpenForms)
{
if (frm is MyFormClass)
{
return (MyFormClass)frm;
}
}
Where MyFormClass is the class of the form I want to find.
Hope that helps.
ChrisB
|
|
|
|
|
Hi Chris,
I am asking to change the Window Class name.
Your solution find open forms inside a .NET process.
I am trying to find a window from another process. So there is no access to Application.OpenForms.
The API to do this is called FindWindow, it is a Win32 API.
In Win32 each window has a ClassName which is a classifier and nothing to do with C++/C# classes.
Use the Spy++ with .NET windows (forms) and you will see that the Window ClassName is not unique (all .NET forms have the same ClassName).
I simply want to customize this ClassName for my forms.
Thanks anyway.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Hi,
I'm looking for a way to specify the port numbers of a TCP connection via a TCPChannel object. I use the TCPChannel because
I need to receive callbacks in my client application:
<channel ref="tcp" port="8085" rejectRemoteRequests="false" exclusiveAddressUse="true" useIpAddress="false">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
<provider ref="secureHandshake" />
</serverProviders>
</channel>
The client instantiates the remote object in a common manner:
(ILogin) Activator.GetObject(typeof(LoginProvider), serverPath) // serverPath="....:7912"
Sysinternal TCPViewer tells me about the following established remoting endpoints:
Process Local Remote
Client.exe nb2h130c:8085 nbgh62091033:2147 // Connection#1 used for Callbacks
Client.exe nb2h130c:2176 nbgh62091033:7912 // Connection#2
Question:
Is there a way to specify the client port number (2176) of connection#2 and the number of the server port (2147)
Another strange behavior is, that these both connections will be periodically removed and new established with other port numbers, while client and server are still working without any problem.
In the internet, I only came across the information to set a fixed endpoint for COM+ applications.
Thanks for every reply
Thomas
|
|
|
|
|
I have made a deployment Setup Project in VS2005. I have two question reagrding it.
1. How can I check before the installation starts whether service pack is installed on the machine or not?
2. It generates a couple of files and folder. How can i package them into single self extracting executable file?
Any kind of help, suggestion or link would be highly appreciated.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi.
How do I get the size of a COM object in C#?
Note that the COM objects I refer to support IPersistStream, but the MaxSize property isn't really supported by them.
Thanks alot.
Dirk
|
|
|
|
|
Hi,
I have a question on the article mentioned in the Subject.
I find it really helpfull but i have one Probleme.
I working with .Net 2005 an MS Outlook 2007.
To bring it to the point my Problem is that my PropertyPage is not Displayed in the Options Menü.
I don't understand that because he is perfoming the pages.Add(new OptPage(), "UsrPage") Method but nothing happens.
I used the Debug mode and I realised that the Caption Property is ignored (never performed)
[DispId(-518)]
public string Caption
{
get{return "DEMO";}
}
But I really don't know why because up to this point everything is performed in the same way.
So I would be really thankfull if someone can help me
Thx in advanced
SquallNaruto
If one eye is focused on the goal
then only one eye is left to find the way
|
|
|
|
|
To get work done a little faster with a datagridview I thought about assigning shortcut keys to value in one column. These shortcuts are configurable so that the user can change them. The code to find the right item for a given shortcut looks like this:
if (shortcutparts[0].ToLower() == "alt" && e.Alt &&<br />
shortcutparts[1].ToLower() == e.KeyCode.ToString())<br />
{<br />
itemsGridView.CurrentRow.Cells[1].Value = <br />
group.Name;<br />
}<br />
else if (shortcutparts[0].ToLower() == "ctrl" &&<br />
e.Control &&<br />
shortcutparts[1].ToLower() == e.KeyCode.ToString())<br />
{<br />
itemsGridView.CurrentRow.Cells[1].Value = group.Name;<br />
}
But there's a problem, that column is edited using a combobox, which doesn't accept the value I assigned to it, eventhough it does show the right value the first time. Anybody have an idea how I can get it to work?
WM.
What about weapons of mass-construction?
|
|
|
|
|
hello all,
I am new to C# and would like your help in this matter.
I know this is the syntax to declare a single dimensional arraylist in C#
ArrayList arraylist_name = new ArrayList().
Can anybody tell me as to how I can declare a 2 dimensional arraylist and access the same?
Thanks in advance.
Keshav V. Kamat
Systems Engineer
Siemens
India.
|
|
|
|
|
The best way to create that is to use the hashtable, although its a map and not a list you can still access the keys as if they were a list of values.
Hashtable table = new Hashtable();
To create a two dimensional arraylist you will have to write something like this:
ArrayList list1 = new ArrayList();
for(int x = 0; x < 10; x++) {
list1.Add(new ArrayList());
}
but this uses significant more memory and is not advisable if you only need the first lists index to access the second list. In that case you are better of with a hashtable that uses an Int32 value as key and ArrayList as value.
WM.
What about weapons of mass-construction?
|
|
|
|
|
thanks.
i will try that out.
Keshav V. Kamat
Systems Engineer
Siemens
India.
|
|
|
|
|
Ther are 2 things you could do.
1) If you know the size of the dimention you want to create, you could make an array of ArrayList.
ArrayList []list = new ArrayList[10];
for( int i = 0; i < 10; i++ )
{
list[i] = new ArrayList();
}
2) If you want a variable length (dont know the length) you could create an ArrayList of ArrayLists.
ArrayList list = new ArrayList();
ArrayList subList = new ArrayList();
list.Add(subList);
|
|
|
|