|
try:
DataView compSort = comparisonDocs.Tables[0].DefaultView;
|
|
|
|
|
Thanks, I did that. It turned out the sort was working, but the way the old code ( which I didn't write ) got it's details to render involved an array of objects instead of the data in the table...
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Glad to see you got it working. I had a reply sitting at work that I couldn't submit because the site wasn't working ("The resource is in use").
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Why don't you try prefixing the field with the table name followed by a period.
[EDIT]
Just read you got it working, sorry, I should read through everything before posting!
[/EDIT]
- Nick Parker My Blog | My Articles
|
|
|
|
|
I've been developing a project using VS.NET 2003 for well over a year. Today I'm building the installer (Setup.msi), and when I test it out, I get the usual "Preparing to install files" (or whatever) message box, and then I get a message box that says "<error message="">".
I haven't changed that much in my solution lately. I had recently installed the .NET bootstrapper plug-in, but even after uninstalling that, I still get that when I build installers.
Any ideas or tips? Any ways I can effectively debug the MSI or get some verbose logging?
Thanks,
Arun
|
|
|
|
|
If you read the Command-line Options[^] for Windows Installer, you could construct the following command-line for verbose logging:
msiexec.exe /I Setup.msi /L*uv Setup.log Typically, find the first error reported (although sometimes errors occur that aren't vital for the installation to continue, so ignore those).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks!
Turns out it was an invalid (empty) launch condition that lingered around instead of being deleted.
|
|
|
|
|
I have a MDI application in which one of the child windows opens a modal dialog. If the focus is switched off the MDI app to some other open app, Windows seems to loose track of the MDI app (can't alt-tab to it, etc.) until focus is restored to the dialog by clicking on it. But every time focus is shifted, the MDI form is set as the focus and not the modal dialog. How do I prevent Windows from seemingly losing track of my app? I have added code to the MDI form's Container Activated event which gets around this problem seems like a very convoluted way to solve the problem.
Thanks in advance
~ D
|
|
|
|
|
Hi!
I want to make an Excel 2003 Add-in in C# that, when is loaded by the user, it opens a Form.
I have searched in several sites and until now I only found how to make add-ins that are automatically loaded when Excel starts.
Does anybody can help me?
Thanks!
Paulo
|
|
|
|
|
You should start by reading the content in the Microsoft Visual C# Developer Center[^] for the Office 2003 System. This includes many, many articles and other topics about add-ins and other enhancements to Office using .NET.
The basic idea is that both Office and Visual Studio utilize a DTE (design-time environment) that is very extensible, but you must read the documentation to know how to do it. There are many articles if you look in the right place, and that link above is the best place to start.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
I am getting the following error when trying to update database table:
"Error: Update unable to find TableMapping['Table'] or DataTable 'Table'.
Here is the code snippet that is throwing the error (specifically, the Update() command )
if (upDateFlag)
{
//update
SqlConnection dataConnection = new SqlConnection("Integrated Security=true;" +
"Initial Catalog=SPIRIT2TEST;" + "DataSource=TECHSERVER") ;
SqlDataAdapter adap = new SqlDataAdapter("SELECT * FROM Dept", dataConnection);
adap.Update(changedDataDs, "Dept");
ds.AcceptChanges();
}
catch (Exception e)
{}
Can you please point out what I might be doing wrong...
Thanks
|
|
|
|
|
According to this snippet, you have no SqlDataAdapter.UpdateCommand , InsertCommand , or DeleteCommand . How do you expect the SqlDataAdapter.Update call to update the database based on the connection and changes in changedDataDs ? You need to either assign the appropriate SQL statements with the properties I mentioned above, or use a SqlCommandBuilder when you specify the fields (instead of an asterisk in your SELECT statement).
Also, you don't need to call DataSet.AcceptChanges after calling SqlDataAdapter.Update , since Update calls AcceptChanges for you.
Finally, just because your SELECT statement includes "Dept" for a table doesn't mean that changedDataDs does. This is most likely the source of your exception, though even if it did contain the "Dept" table the lack of UPDATE, INSERT (typically separated by a semi-colon along with a SELECT to make sure auto-assigned fields are filled-in correctly), and DELETE commands would also throw an exception.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
In a winapp i embed a web browser control and a richtextbox control,for one way i use :"richTextBox1.Text=((mshtml.HTMLDocument)axWebBrowser1.Document).documentElement.innerHTML " to get html file to richtextbox, after modify this content ,how can i get it to mshtml?
|
|
|
|
|
Cast AxWebBrowser.Document to UCOMIPersistFile (a COM interface declared in .NET in the System.Runtime.InteropServices namespace; casting a COM-imported interface performs a QueryInterface for it) and use the Load method:
richTextBox1.SaveFile("temp.html",
RichTextBoxStreamType.UnicodePlainText);
UCOMIPersistFile file = (UCOMIPersistFile)axWebBrowser1.Document;
file.Load("temp.html");
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Do the method you give above work like this :richtextbox->file->be loaded in
axWebBrowser?
Every time the browser want get the content of richtextbox,it should first convert
to .html file?
are there some differences with underside?
richtextbox1.SaveFile("temp.html", RichTextBoxStreamType.UnicodePlainText);
object oEmpty =null;
axWebBrowser1.Navigate("temp.html", ref oEmpty, ref oEmpty, ref oEmpty, ref
oEmpty);
|
|
|
|
|
You said you copied the actual HTML into the RichTextBox , so I can only presume that the RichTextBox contains HTML markup. In this case, you can do exactly what I told you that you can do, or you can use Navigate or Navigate2 . Either way works. If you understand COM and read Programming and Reusing the Browser[^], you'd see that the coclass for IHTMLDocument also implements IPersistFile , which is declared in .NET as UCOMIPersistFile as I said before.
If you're looking for something to convert RTF to HTML, then you should use google[^] to find such a component (or, for internal applications where you have control over system dependencies, you can interop and use Word). Nothing in the .NET BCL (base class libraries) provides such functionality.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
now i think to save html file to memorystream,then to load it to axWebBrowser,how can get it?thank you again!
|
|
|
|
|
IIRC, WebBrowser.Document also implements the IPersistStream interface, but some work will be required. Not only do you have to declare the IPersistStream interface correctly (don't forget the right IID in the GuidAttribute and use the ComImportAttribute ), but also the IStream interface, which you'll need to implement in a class that can read from a MemoryStream - basically used to transfer the buffer as the WebBrowser will request it from the IStream interface.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i declare the IPersistStream interface as below:
public interface IPersistStream
{
[PreserveSig]
int IsDirty( );
void Load([In] UCOMIStream pStm);
void Save([In] UCOMIStream pStm, [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);
void GetSizeMax(out long pcbSize);
};
the i implement it form WebBrowser as below:
IPersistStream file = (IPersistStream)axWebBrowser1.Document;
But VS.net said it's not valid,why?
|
|
|
|
|
Don't forget that you need to attribute imported COM interfaces with the ComImportAttribute , otherwise casting will be type casting instead of QI'ing for the COM interface.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ye,i declared it :
[ComImport,InterfaceType(ComInterfaceType.InterfaceIsIUnknown),Guid("00000109-0000-0000-C000-000000000046")]
|
|
|
|
|
This time i tried IPersistStreamInit Interface,and get convertion form webbrowser to IPersistStreamInit,i think maybe the axWebBrowser1 implement IPersistStreamInit not IPersistStream.MSDN said:This interface is not derived from IPersistStream; it is mutually exclusive with IPersistStream. An object chooses to support only one of the two interfaces, based on whether it requires the InitNew method.
|
|
|
|
|
Yes, that does seem to be correct. It's been a while since I had to do this in our product, and I do realize that IPersistStream and IPersistStreamInit have no relation to each other.
Good find.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Now,the webborwser implement the IPersistStreamInit(has declared) by:
IPersistStreamInit file = (IPersistStreamInit)axWebBrowser1.Document;
and have get the memorystream by:
Stream myStream=new MemoryStream();
richTextBox1.SaveFile(myStream,RichTextBoxStreamType.UnicodePlainText);
this time,can load file by file.Load(UCOMIStream pr);
But now problem is :Load mothod need UCOMIStream as a parameter,but now we just have myStream,how can i do? thank you very much!
|
|
|
|
|
As I mentioned before, you'll need to implement UCOMIStream in your own Stream derivative (or, really, any class). That class should take a reference to another Stream and basically wrap the methods. It's really not too difficult, even though the way in which data is read and written is a little different and because UCOMIStream has some methods that won't easily map (like Stat ), but you could probably just ignore any specific implementation for those particular methods (I did some time back and it worked fine).
Of course, if you encapsulate a Stream derivative like FileStream , you could encapsulate every method of UCOMIStream , but that is pretty limiting. You could always do some type checking on the Stream that your implementation references, but if you're doing this for a specific purpose and don't plan on using it for anything else in your project, I wouldn't bother.
Microsoft MVP, Visual C#
My Articles
|
|
|
|