.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WebBrowser.Document.ExecCommand(..) causing input method to change

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :Windows Application

I am making an IM client, and I've used the Forms WebBrowser control as a WYSIWYG-like editor. Unfortunately I also have to support alternative input methods, like Japanese and it's causing me grief.

To clear the editor after sending a message I call the following on myWebBrowser control:

myWebBrowser.Document.Body.InnerHtml = "";
myWebBrowser.Document.ExecCommand("FontName", false, _selectedFont);
myWebBrowser.Document.ExecCommand("FontSize", false, _selectedSize);

This works for English languages, but for Japanese this causes the input method to change from hiragana back to English characters. 

Does anyone know how I can set the font without breaking the set input method?



View Complete Post

More Related Resource Links

Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not

Hi,I am looking for a Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not. To know it currently I am using "Directory.GetFileSystemEntries(Path).Count" and checking if count > 0 then returning True else False. For this first method calculates all the files and folder and then return status to me but I want to exit out as soon as my method gets first element(file/folder) in specified path. Because above method is timing out when my input path contains more than 1 million files. I just need to check whether input folder path contains any child file/folder or not. I have tried to use Win32 API also but on ther server it is crashing so I donot want to use that solution. In .NET any method or way is present to know it. Please suggest me.

How to open an excel document in a webbrowser control

Hi,  I have an XBAP app that we would like to be able to open an Excel doc in a WebBrowser control but instead we always get prompted to opne in Excel.  Is this possible?  Here is what I have tried.  The reports are in SharePoint but we want to show them in our own application not SharePoint.       System.Windows.Forms.WebBrowser ReportView = new System.Windows.Forms.WebBrowser();     WindowsFormsHost ReportViewHost = new WindowsFormsHost(); ReportView.Navigate(_fileName,   "_self", postBytes, "Content-Type: application/vnd.m?s-excel"); ReportViewHost.Child = ReportView;   _filename would be something like http://localhost/shared%20documents/myfile.xslsx Thanks for any suggestions. Rhonda

"max-template-document-size" change not working as expected

Hi There I have a 2 node MOSS 2007 deployment hosting 5 webapps. The one web app I am having a problem with is a customised solution from a 3rd party. The product users need to save sites as templates, to which they get an error saying that the template is too large. I have run the max-template-document-size stsadm command and increased the value from 5mb to 50mb but it seems the change is not taking effect. The error page says the limit is still 5mb. When I use stsadm getproperty it shows that the value has in fact increased. I have made sure that I am doing this on the correct webapp. The save as template operation works if I do not select the "save content" option. The sites have no content so the cannot be greater than 50mb. Am I missing something extremely obvious?

How can I change the height of the rows in a document library webpart view to minimize the space bet

In SP2010 documents listed in a document library view (attached as webpart) are quite far from each other (height of each row is too big). How can I change the height that spaces between the documents are limited to a minimum, hence more documents are visible on my screen. (e.g. if I have many documents in my document library and add a webpart to my page that should show all documents, I would see more documents if the height of the row would be smaller (e.g. 16px) and spaces minimized. Moreover how can I make a smaller height for each row the default height?

Script Component - Change One Row Input to Multiple Row Output

Hi All I am new to SSIS, and looking for help. I do not know if it is possible, but I like to try using the "Script Component" to change a input like this:   1234 1235 1236 ...   to and output like this:   1234, Value1 1235, Value2 1235, Value3 1235, Value4 1236, Value5 ...   Depending of the input value, 1 or more Rows are pushed out the Output, Like the value 1234 -> result in 1 Row in the output, where the value 1235 -> result in 3 rows in the output. Is this possible to do in a Script Component?? If it is how do you program such behavior? Do some good sources to learn SSIS exist out there?? I think it is not easy to find information. Peter Schwennesen

Input Parameter in Finder Method BDC Model

Hi Guys, I know it is possible to create a Finder method with an input parameter, but I am trying to figure out how to pass the parameter to the method. Here's my isssue:   I have created a BDC Model in VS2010, my finder needs to have an input parameter. This input parameter is available on a list that is already available on my site. What are my options to pass this parameter to my finder method and display the results?   My intention (not sure if it makes sense) is to create and action for the model of the list that is already available, so I can capture the variable and pass it in a query string to  a list that I create for the Finder method that requires an input parameter. The problem is I dont know how to do this or even if it the best way to go about solving the problem. Using a business data list and business data related list while possible is really not an option.   Thanks  
tag background   

If there is validation error in input box, then how to change its parent <td> tag background-color?

<td id="td1">
                                    <asp:RequiredFieldValidator ID="rfvtxtName" runat="server" ErrorMessage="Specify your Name."
                                        ControlToValidate="txtName" Display="Dynamic" ValidationGroup="vgSubmit" 
                                        CssClass="fieldError" SetFocusOnError="True"></

How to Set System.Windows.Controls.WebBrowser.Document Property , navigatetostring,stream DONT WORK


Hi , i search in google , bing , cuil and all of searchs provider for the solution of this problem :


I get HTML content from HTTPWebRequest(because is much requests and if i use WebBrowser control directly i get a lag and video processing unnecessary)


And i need  set System.Windows.Controls.WebBrowser.Document with this text.


"Solution" , use new methods call NavigateToString() or NavigateToStream()

BUT THIS PROBLEM , both DON'T work with <javascript src="something.js"> or <style src="something.css">

Navigates ONLY read and process content INSIDE this tags , no external files (like 'something.js')

Solution i encountred after two weeks of search

Process the text and replace the files by the content of that.

But this i think that is no real solution. (i tested , work , but not perfectly) * I write my own code because that post dont have source code.

for why you need to do that?

because i need interact with users after search , and use html's input to re-search again and process this file with all extern files is too slow

Any solutions?

C# Lenguage

Sorry for bad english, i'am brazilian.


Change Document Library default action on Items



I have a standard Document Library where I uploaded various  kinds of file (.pdf, swf). Whenever I click on an item (or I paste its direct link into the browser) it prompts me to download it instead of opening it into the browser directly (with flash player or acrobrat in my example).

How to obtain the desired behavior? Thanks

Document set - GenerateDocumentID method gets called twice



I have implemented a custom document ID provider and it works fine. But for document set, the GenerateDocumentId method gets called twice.

Am i doing wrong something here or it is like this by design?



Add textbox and change ActionLink to use textbox input


How do I add a textbox for user input in the view and then change the link below to user the user input instead of the hard coded ID?

<%= Html.ActionLink("click me", "Index", new { id = 10057 } ) %>

Employee name change causing weird issue...


Recently, one of our female employees got married and changed her last name.

old login:


new login:



The problem is that even with her new login name (domain\nnew), when she goes to a web page whoes sole job is to display the current logged in user logon name [HttpContext.Current.User.Identity.Name], it shows... domain\mold.

Also, the PC she is using is brand-new. In other words, the PC was build after her name change. So, there isn't any conflict on the PC itself. I am puzzled at this point.

Thanks for any help


Error When a Word Document is displayed in WebBrowser Control



We are using a WebBrowser control to display an MS Word document in a form. This was working fine for a long time, and now we tried to install this application in a new server. Now we are facing an issue. When we try to open the word document by using WebBrowserControl.Navigate method, it is asking the Open/Save dialog box, which is typically displayed when we download a file. Then if the user clicks on Open button, we are getting an error "Windows cannot find 'UsersTempFolder\1\Temp\MyDoc.DOCX'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.". Please note that UsersTempFolder\1\Temp\MyDoc.DOCX is NOT the path I have given in Navigate method. Also, if I click Save in open/save dialog box, I can save to a location and open it.

I don't have direct access to this server, but if I can believe the words of support person, every configuration is set same as our old server. Here is the details.

.NET Framework 3.0

MS Office 2003

Internet Explorer 6 SP2.

Could any one please help me to solve this issue? Any help is very much appreciated. Please let me know if you need any other details.



Read web method input parameter in UTF-8 encoding



I have a web service written in ASP.NET 2.0 using Visual Studio 2005. The web service contains a web method which takes in a string parameter:


[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
    public Service()

        //Uncomment the following line if using designed components 

    public string DoProcess(string input)
        // Do some processing...
        // ....           
        return result;


The web.config file contains the <globalization> tag.


This web method will be called by a third-party client, which will be sending data in UTF-8 encoding. But during development, I created my own test client to test the web method. The client passes in the Unicode characters in UTF-8 as input to the web service method.

I discovered that if the HTTP headers in

Change document version number via database


Hi all,

I was blocked by an issue of document version number. The customer wants to move a document from one document library to another. After the document is moved, version number should be kept the same and metadata values of each version should also be kept.

File.MoveTo(string newUrl) method can move file and keep the same version number but lose the metadata in previous versions. Only the latest version has metadata values. Also this method cannot move file cross site collections.


Following is my solution:

1. Upload all the versions along with metadata to the new location and then delete the old file.

2. Update document version number in database directly.

Finally the solution works well, but I don't know if step2 will impact any other default logic in SharePoint system. Below is the logic to update version number.

            SqlConnection cn = new SqlConnection(connStr);
            SqlCommand cmd;
            string cmdTxt;


            cmd = cn.CreateCommand();

Conditionally Change Folder Icon in document library view (SP 2007)


Hi All,

How can I change the folder icon in the default document library view?  The catch is, I don't need to do this across the board, instead, I need a custom folder icon based upon the individual folder's properties.

I'm aware of the file ..\Web Server Extensions\12\TEMPLATE\XML\DOCICON.XML, but that's not what I need.

My initial thought, was to find the page that sharepoint uses as the template, find the <img> src attribute, and chnage it from


to something like


my GetIcon.aspx page would then look up the folder's properties, and return the expected .gif file.  However, I don't know which file is used.


System.Windows.Forms.WebBrowser unable to update or change


I am using this WebBrowser component in a C# project.

I have declared and use "_wb" as shown below::

string httpcmd = @"https://...........";

System.Windows.Forms.WebBrowser _wb = new System.Windows.Forms.WebBrowser();                
_wb.ScriptErrorsSuppressed = false;                
Uri myuri = new Uri(httpcmd);
_wb.Url = myuri;
while (_wb.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete)


The above code in within a class.

Once my program uses the above code once, it then does seem possible to change.

i.e. After the first iteration, nothing changes each time the code is run.

The DocumentText property I reference stays the same once it is set.

It is like the URI is not even re-sent.

Only if I close the application and then re-run then the webbroweser will update as desired.

I have seen many references to this problem but have not been able to resolved it.

Can anyone suggest how to get this componet to reset or clear so it behaves like I have re-run the application?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend