|
How can I make the Combo Box Show all items by code in the Compact Framework?
|
|
|
|
|
when i use telnet to send mail, it occurs error like that
"553 sorry, you have to authenticat first to be able to use this smtp server".
please help me to slove this problem.
thanks...
|
|
|
|
|
Send the proper command to authorize the client, just as the server indicates. If you say EHLO instead of HELO to the SMTP server when you connect, it gives you a list of support authentication modes. You must support one of those and authorize yourself as requested.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi..
I have a listview control on a form..For this i added 3 ColumnHeader's..Later i added few items to this class..When i try to resize these columnheaders all the items in the listview are also getting resized properly..
But my question is when i try to resize any columnheader in the listview control, i want an event to be raised in my code..so are there any default listview events which are raised for this..if not how can i do this..
Thanks in advance..
-Sudhakar
|
|
|
|
|
|
I'm trying to get office automation working, and most things work except working with the Find object. For some reason, every time I try to access the Find object (both through Selection or Range) I find that the Find object is a null reference. If I try to add a watch to my Document and debug, when I expand the Selection then the Find object, my debugger crashes. I am running Office 2000. Trying similar code in VB.NET yields similar results.
The following is a simple Console app that I created to test this. It only requires that the "C:\TestFindReplace\TestDoc.doc" is a valid path with a word doc that contains the text ":FULLNAME:" somewhere. Of course, you can change the filename and path to whatever if you want to test this code. Also, you will need to add a reference to the Microsoft Word 9.0 COM object.
<br />
[STAThread] static void Main(string[] args)<br />
{<br />
Console.Write("Enter the person's name: ");<br />
string fullName = Console.ReadLine();<br />
Console.WriteLine();<br />
FindReplace(fullName);<br />
}<br />
static private void FindReplace(string fullName)<br />
{<br />
object oFileName = @"C:\TestFindReplace\TestDoc.doc";<br />
object oNewFileName = @"C:\TestFindReplace\" + fullName + ".doc";<br />
object oFalse = false;<br />
object oMissing = Type.Missing;<br />
object oReplaceAll = Word.WdReplace.wdReplaceAll;<br />
<br />
Word.Application WordApp = new Word.ApplicationClass();<br />
Word.Document myDoc = WordApp.Documents.Open(ref oFileName,<br />
ref oMissing, ref oFalse, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oFalse);<br />
try<br />
{<br />
myDoc.Application.Selection.Find.Text = ":FULLNAME:";<br />
myDoc.Application.Selection.Find.Replacement.Text = fullName; <br />
myDoc.Application.Selection.Find.Execute(ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing,<br />
ref oReplaceAll, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing);<br />
myDoc.SaveAs(ref oNewFileName, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
ref oMissing, ref oMissing, ref oMissing);<br />
}<br />
finally<br />
{<br />
WordApp.Quit(ref oMissing, ref oMissing, ref oMissing);<br />
}<br />
}<br />
Is anyone getting behavior like this? Does this code work for anyone else?
|
|
|
|
|
That's because the Find object isn't part of a Document object (at leat in Word 2003). It should look more like this:
object oFileName = @"C:\TestFindReplace\TestDoc.doc";
object oNewFileName = @"C:\TestFindReplace\" + fullName + ".doc";
object oFalse = false;
object oMissing = Type.Missing;
object oReplaceAll = Word.WdReplace.wdReplaceAll;
Word.Application WordApp = New Word.ApplicationClass();
Word.Document myDoc = WordApp.Documents.Open(ref oFileName,
ref oMissing, ref oFalse, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oFalse);
try
{
Word.Find fnd = WordApp.Selection.Find;
fnd.Text = ":FULLNAME:";
fnd.Replacement.Text = fullName;
fnd.Execute(ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oReplaceAll, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Unfortunately, I get the same error. I'm using Office 2000 and I suspect that it might be a problem with this version of office. I had a co-worker with the same PC configuration run this app and he got the same error.
I'm leaving for two weeks of vacation tomorrow, so I'll have to put this issue on hold until I'm back. Thanks for your help!
|
|
|
|
|
Hi
We have a system which is written in C++/MFC but I have just written a support tool in C#/.NET.
This is all new to me and we need to be able to show an already running copy of the app from the C++ system.
We were going to use FindWindow() from MFC, but would prefer to set the class name rather than just rely on the window caption. However I cannot find any equivalent to RegisterClass() in .NET and if I set CreateParams.className the .NET app blows up with an 'Invalid Windows class name' exception.
Does anyone know how to set/register the class name so we can uniquely identify our support app?
|
|
|
|
|
Every control is already given a class name. Use Spy++ from the Platform SDK (installed with Visual Studio in default installs) to determine what that class name is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the quick reply.
I have tried Spy++, but every .NET app I have written seems to have the following class name "WindowsForms10.Window.8.app1".
Is it possible to override the automatically generated name or supply some string which will be used as part of the automatically generated name?
|
|
|
|
|
If you examine the child windows, you might notice a pattern: WindowsForms10.ClassName[.8].appN . You can change the class name for a window but you have to register it first, which means you must P/Invoke RegisterClass , which of course means you have to define the WNDCLASS struct in managed code (with proper byte alignment and marshaling). You could then use this window class in your override to CreateParams .
[DllImport("user32.dll")]
private static extern ushort RegisterClass(ref WNDCLASS lpwcx);
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
private struct WNDCLASS
{
public UIntPtr style;
public WndProc lpfnWndProc;
public IntPtr cbClsExtra;
public IntPtr cbWndExtra;
public IntPtr hInstance;
public IntPtr hIcon;
public IntPtr hCursor;
public IntPtr hbrBackground;
public string lpszMenuName;
public string lpszClassName;
}
private delegate IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); Of course, you must provide it with all the data necessary. The WndProc delegate should point to Control.WndProc , and the other data you can marshal from various properties of the Form or any other Control derivative. Use the Marshal class for assistance if necessary.
Once you've done that, the final window class would most likely be WindowsForms10.YourClassName.appN .
Another option you could consider is using global memory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi to all,
I am trying to change a boolean field in an Access database table.
<code>
DataRow[] selectRows = dscurr1.Tables["currlist"].Select("curr='true'");
foreach (DataRow myRow in selectRows)
{
idx = Convert.ToInt32(myRow["notableID"]);
}
</code>
This locates the index to the row that has the only boolean True row in this small table, but now I need to change it to False and realize I need to use an indexer to the DataRow but am lost as to how it should be laid out syntacically.
Regards,
Bill Antonacchio
|
|
|
|
|
Just use myRow["curr"] = false . If this isn't what you're asking about, please rephrase your question.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You're right - it is simple: simply create a new OleDbCommand around an UPDATE statement, or if you just change it in the DataSet like I showed you before, pass it back to an OleDbDataAdapter using the Update method, which requires that you have the OleDbDataAdapter.UpdateCommand assigned (plus InsertCommand and/or DeleteCommand if you want to support INSERT and DELETE statements as well). The SelectCommand is required.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How about
myRow["curr"].Value = false;
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
BillAnton wrote:
Clues?
Yeah - try reading the .NET Framework SDK documentation, seriously. OleDbDataAdapter.Update takes a DataSet . As I said, you update the value in your DataSet (via the DataRow as I coded in my first reply). Then, you pass that DataSet (without calling AcceptChanges first) to OleDbDataAdapter.Update . If you have your OleDbDataAdapter.UpdateCommand set to a valid OleDbCommand with an UPDATE SQL statement, then the value in the database will be updated.
Sorry, I hate to sound rude but this is supposed to help you learn, not just take what I or anyone else said (which you didn't follow my directions anyway) and using it. Learn why I or anyone else said that and understand. That's what's important.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a showmodaldialog window where user will create one server object, can anybody let me know how do i pass the server side object back to parent window
|
|
|
|
|
In the ShowDialog window, you would make this object public and fill it with the necessary information with the normal course of your ShowDialog code. When you ShowDialog method returns to your main form code, your main form would have to set a reference to the public object, then call Dispose on the ShowDialog form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Gurus
Is there any free/community/gnu/open source/whatever C# refactoring addin for visual studio?
|
|
|
|
|
Visual Studio .NET 2005 will come with this, I just saw a demo of the Refactoring and it is sweet.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi there!
I've once seen some tools mentioned in a magazine. First had to search this, so the answer took a bit longer. Can't say if they are helpful because i never used them myself.
Search the web for "opnieuw" and "Name Manager for VS.NET". The second one is developed by the firm ScrujSoftware but should be free of cost.
Hope this helps!?
www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote:
Can't say if they are helpful because i never used them myself.
Same here, I too damn scared they break my 31337 code
top secret xacc-ide 0.0.1
|
|
|
|
|
hello,
i would like to know if there's a method in C# that can copy a hole directory with its files and subdirectories.
thanks
|
|
|
|
|