|
Thanks. That did the trick, once I went into the generated source and remove the DialogResult.Cancel that had been placed in the browse button section.
Thanks again.
--G
|
|
|
|
|
It is like Christian said. But if I remember correctly you can also set the DialogResult in the BrowsClick event manually to override this nasty behaviour:
public void Browse_Click(object sender, EventArgs args) {
if (DialogResult.OK == openFileDialog.ShowDialog())
{
textBoxDestinationDB.Text = openFileDialog.FileName;
}
base.DialogResult = DialogResult.None;
}
|
|
|
|
|
Hmmm. I've already implemented Christian's suggestion and it works. I tried what you have above, with the exception of base.DialogResult = DialogResult.None. I'll keep that in mind for future forms. Thanks very much, if I had seen this sooner, it would have resulted in less work for me!
--G
|
|
|
|
|
To be more specific, I need the code for a text editor / RTF editor that I'm working on and I'm more than a little bit new at this coding thing, so I'm not too certain as to where to look for good clean snippets that provide the functionality that I need. I'd try to write the code myself, but I have at the moment a lack of two things: Time, since I've joined the Naval Reserve, and am studying a lot - and appropriate knowledge, since C# is essentially my first programming language since the "good ol' days" of Level 2 BASIC (anyone out there remember that one?).
Anyhoo, any help than you can all provide would be greatly appreciated.
Specific functionality that I'm trying to implement, but haven't found a clue to:
Global search and replace among all documents in an MDI environment.
Specific search and replace on a per-document basis.
Undo/redo functionality for both of the previous cases would also be good.
Thanks in advance for any help, and if you provide code, you'll be appropriately credited
B Turner
Some say that ignorance is bliss... Blissful, aren't they?
|
|
|
|
|
The string class has search and replace methods, that is, if your text is one big string, you can use the replace method to do search and replace, or you can use other methods to find the strings without replacing.
I'm not sure how to iterate through all documents in an MDI app, but I'm sure google can help here.
The easiest way to do undo is to make a copy of your document in memory before each action and push them on to a stack. If you want to only store the differences between documents to save memory ( no need with text, I would think ), then you need to get a little more complex.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
I'm not sure how to iterate through all documents in an MDI app,
foreach(Form form in this.MdiChildren)
{
TextDocumentForm textForm = form as TextDocumentForm;
if(textForm != null)
{
}
}
Now you know!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I would place this code into the MdiParent, right?
Something tells me that that's the only logical place to put it, but I wanted to be sure.
Thanks again
Brian Turner
|
|
|
|
|
Yes, only an MDI parent window (IsMdiParent property set to true ) can have MDI children.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I think that what I need is a code snippet, know of any good places to get that? Reason being is I learn better by having something to emulate. I'm still learning how to implement various classes. I'll post the code that I have so far, when I am able, so that you can all have something to chuckle at
Thanks for the help
Brian Turner
Some say that ignorance is bliss... Blissful, aren't they?
|
|
|
|
|
string theDocument = LoadString(); // This method does not exist, you need to get the text of the document
theDocument.Replace("oldstring", "newString");
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi guys,
Is there anyway I can load and view fonts that are not in the font folder? Scenario, I want to open and browse 3 or four differing folders on my computer with different fonts that I don' want to install till I've seen all of them. And being able to print them is a bonus...!
Cheers for any pointers,
Enumerating system fonts is easy....
|
|
|
|
|
|
Given a table name (e.g. CUSTOMERS), how do I get column names of the table and the data types of the columns the table has?
I am using SQLServer and would like to get that info from my C# code.
|
|
|
|
|
|
Or something similar?
|
|
|
|
|
Well you could say what spawnlp does... it would save me from googling.
Take a look at Process Class[^]
David
|
|
|
|
|
It's gone from C++ .NET apparently...
_spawnlp, _wspawnlp
Create and execute a new process.
int _spawnlp( int mode, const char *cmdname, const char *arg0, const char *arg1, ... const char *argn, NULL );
|
|
|
|
|
I found it thanks.
using System;
using System.Diagnostics;
using System.ComponentModel;
It's Process.Start("someprogram.exe");
|
|
|
|
|
Does anyone know how to override the Listview items property so that it will populate the listview with my custom ListViewItemCollection? I was able to use:
ListViewItemsExtra m_ItemsExtra = new ListViewItemsExtra();
new public ListViewItemsExtra Items
{
get{ return m_ItemsExtra; }
}
this did override the property and adds my custom listview items to the collection, but they do not show up in the listview. I was hoping to overide the ListViewItemCollection and have it use my custom Item without redrawing the objects in the listview.
Lamont Bullock
|
|
|
|
|
I don't know if you can make the ListView using m_ItemsExtra instead of the, probably, private class member it uses to list its items.
Why not trying a different thing? I mean.. if I want more/own functionality in "my" ListViewItem, I'd inherit ListViewItem.
public class MyListViewItem : ListViewItem
I can still use it with the ListView because it is implicitly casted to ListViewItem (I guess on the implicit cast).
|
|
|
|
|
Zarrab,
Sorry for not being more clear on how I went about the Listview control. I did create a new Listview class and it does inherit the properties of the .net listview class. This is why I want to override the listview's items collection with my own. I tried creating a new property called ItemsExtra and a custom ListViewItemExtraCollection to store the ListViewItemsExtra class objects. using the get{} accessor I am able to add ListViewItemsExtra to the collection fine, but the IDE doesnt automatically create the code
below that it does for a normal listview item.
listViewExtra.addrange( new ListViewItemsExtra.ListViewItemsExtraCollection{
this.listViewItemExtra1, this.listViewItemExtra2, this.listViewItemExtra3, etc } )
If I could override the Items property and have it add my custom ItemsExtra object or override the Add() method on the ListViewItemCollection class I may be able to successfully get the ItemExtras in the listview without haveing to redraw them with code. It also works to change the code for a normal listview item to my ItemsExtra object, but that isn't clean like I would like. I want to be able to re-use the control whenever I need it, with the ease of other controls and not have to jerry rig code.
Do you have any suggestions?
Lamont Bullock
|
|
|
|
|
Hi,
Can someone PLEASE help me out.
I keep getting this error: Exception from HRESULT: 0x800A03EC
whenever I get to this line of code:
excel.ThisWorkbook.SaveAs(@"C:/",
Excel.XlFileFormat.xlXMLSpreadsheet, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);
And the localization is already set to "en-US"
E-mail me if you can help out! schoudhr@hotmail.com
it would be GREATLY appreciated
|
|
|
|
|
First, "C:/" is an invalid path. Second, it also doesn't specify a filename.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
thanks for the reply, that was just my many attempts to try anything. this is the original code (which gives the same error):
excel.ThisWorkbook.SaveAs(Server.MapPath("Upload/test.xls"),
Excel.XlFileFormat.xlWorkbookNormal/*xlXMLSpreadsheet*/, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);
I've tried EVERYTHING. If anyone knows how to take that excel object and send it direcly to the client for download as an .xls that would be equally great.
schoudhr@hotmail.com
|
|
|
|
|
I'm creating a custom error dialog, and want it to use the same bell sound as an error MessageBox. I tried writing an ascii 7 (BEL) to the error text, but it didn't work and I'm not sure what else to
|
|
|
|