Click here to Skip to main content
15,892,517 members
Home / Discussions / C#
   

C#

 
GeneralNeed a multiline listview Windows Forms control Pin
Roman R.3-Jan-04 7:37
Roman R.3-Jan-04 7:37 
GeneralRe: Need a multiline listview Windows Forms control Pin
Heath Stewart3-Jan-04 7:47
protectorHeath Stewart3-Jan-04 7:47 
GeneralRe: Need a multiline listview Windows Forms control Pin
Roman R.3-Jan-04 7:55
Roman R.3-Jan-04 7:55 
GeneralRe: Need a multiline listview Windows Forms control Pin
Heath Stewart3-Jan-04 10:59
protectorHeath Stewart3-Jan-04 10:59 
GeneralRe: Need a multiline listview Windows Forms control Pin
Roman R.3-Jan-04 17:21
Roman R.3-Jan-04 17:21 
GeneralRe: Need a multiline listview Windows Forms control Pin
Heath Stewart3-Jan-04 17:24
protectorHeath Stewart3-Jan-04 17:24 
GeneralRe: Need a multiline listview Windows Forms control Pin
Carlos H. Perez3-Jan-04 11:26
Carlos H. Perez3-Jan-04 11:26 
GeneralRe: Need a multiline listview Windows Forms control Pin
Nick Parker3-Jan-04 11:42
protectorNick Parker3-Jan-04 11:42 
GeneralRe: Need a multiline listview Windows Forms control Pin
Carlos H. Perez3-Jan-04 12:11
Carlos H. Perez3-Jan-04 12:11 
GeneralRe: Need a multiline listview Windows Forms control Pin
Roman R.3-Jan-04 17:27
Roman R.3-Jan-04 17:27 
GeneralRe: Need a multiline listview Windows Forms control Pin
hammackj3-Jan-04 21:55
hammackj3-Jan-04 21:55 
GeneralRe: Need a multiline listview Windows Forms control Pin
Roman R.4-Jan-04 5:49
Roman R.4-Jan-04 5:49 
GeneralRe: Need a multiline listview Windows Forms control Pin
hammackj4-Jan-04 10:49
hammackj4-Jan-04 10:49 
GeneralCustom MessageBox buttons Pin
Broken God3-Jan-04 6:24
Broken God3-Jan-04 6:24 
GeneralRe: Custom MessageBox buttons Pin
Colin Angus Mackay3-Jan-04 6:51
Colin Angus Mackay3-Jan-04 6:51 
GeneralRe: Custom MessageBox buttons Pin
jconwell3-Jan-04 18:05
jconwell3-Jan-04 18:05 
GeneralUsing Word with C# Pin
Stephane David3-Jan-04 5:43
Stephane David3-Jan-04 5:43 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 8:03
protectorHeath Stewart3-Jan-04 8:03 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 9:58
Stephane David3-Jan-04 9:58 
GeneralRe: Using Word with C# Pin
Nick Parker3-Jan-04 10:05
protectorNick Parker3-Jan-04 10:05 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 10:16
Stephane David3-Jan-04 10:16 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 10:58
protectorHeath Stewart3-Jan-04 10:58 
Stephane David wrote:
I agree that user should never see an exception, but I think it is even better to write correct code and avoid the exception, rather than displaying the error message.

This is a bad assumption! Did you write Microsoft Word? I'm betting you didn't, so why trust the work of other people whom you probably don't know, and code in another application where a whole different set of problems exist? Never do. Never trust user input, and never trust another application. Always account for problems that might occur. Do you think that Word blindly accepts input from calling functions?

And just because a parameter takes a value of true doesn't mean that the converse is false. Look again at the type: Variant. When a variant isn't specified, it is an empty or missing variant, hence using Missing.Value (or sometimes you see
Type.Missing).<br />
<br />
I found this example on MSDN: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtosearchfortextinworddocuments.asp">How to: search for text in Word documents</a>[<a target=_blank title='New Window' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtosearchfortextinworddocuments.asp">^</a>]. They use <code>Type.Missing
to find text. You have the right values for the ReplaceWith and Replace parameters. Also, you can search over the whole document (since in the example they set the range to the first two paragraphs) by using Document.Content instead of Application.Selection.Range, which - if I remember correctly - is an empty range anyway. I don't know about that, though - it's been a while since I programmed with the Office libraries. In any case, Document.Content is a Range over the whole document, which seems to be what you wanted anyway. Good luck!

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 19:00
Stephane David3-Jan-04 19:00 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 19:02
protectorHeath Stewart3-Jan-04 19:02 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 19:40
Stephane David3-Jan-04 19:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.