winforms,.net-4.0,webbrowser-control , Can't use WebBrowser Scrollbar on winforms

Can't use WebBrowser Scrollbar on winforms


Tag: winforms,.net-4.0,webbrowser-control

I have a Winforms VB.NET application that uses a WebBrowser control to render HTML.

The WebBrowser is embedded into a Panel, which is on another Panel. So the embedding is Form --> Panel --> Panel --> WebBrowser

Whenever the DocumentText surpasses the visible borders of the WebBrowser the scrollbar is displayed and you'd think you can scroll with it, but you can't. The scrollbar does not respond to the mouse input. I debugged for hours now and can't find a solution. Another thing that is off, is that this is the only control where visual styles seem to be deactivated. The scrollbar looks different than other scrollbars on the same panel.

In summary:

  1. Only control that seems to have visual styles disabled
  2. Can't use scrollbar, even though it is not greyed out and actually displays a bar.

I've already created a sample project with this setup, which does not show the same problem. What could be happening here?

Unnormal Scrollbar behaviour in WebBrowser


Okay, I guess I had a pretty unique situation here.

In my code, the WebBrowser was casted to an Control and then set to Enabled = False, which works for a Control, but is not supported for the WebBrowser. Afterwards the WebBrowser was set to Enabled = True. So internally, the WebBrowser was not selectable, because Enabled was False even though this is unsupported by the WebBrowser.

Dim xBrowser As WebBrowser
Dim xControl = CType(xBrowser, Control)
xControl.Enabled = False 'Works
xBrowser.Enabled = True 'Does not work.
'Result: WebBrowser not selectable.


DataGridView KeyDown manipulation (enter, left, right, etc.) not working when multiselect

I want to make the DataGridView more handy while manipulating the KeyDown event, like the KeyEnter for moving one cell to the right, or using left, down or up. I have some special use cases where I want to check first the cell and depending on that I can discard...

Custom drawing using System.Windows.Forms.BorderStyle?

I want to mimick drawing of default border based on value of property BorderStyle. Instead of single border around the control, my control is visualised as four adjacent custom-drawn boxes (2×2), each having standard border drawn individually. So for example, if Control.Border is set to FixedSingle value I want to...

How to get the range of a specific word in Word Document using Word Interop

I am creating a C# program that inserts a table inside a word document. Now, I need to insert a table in a certain position in different word documents. All word documents/templates I have has the word <table> in it where I want to insert the table. For me to...

How do I display an Icon on the Taskbar but not on the form itself?,winforms,visual-studio
If I use ShowIcon in the form properties, I get the icon in the top left of my form (I don't want that), but I do get my icon in the taskbar. If I turn ShowIcon off, then I get no icon on the form but I get the default...

How can i get list of my youtube videos from youtube?

I installed the google api 3 and the OAuth2. And i tried the google develope example: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Google.GData.Client; using Google.GData.Extensions; using Google.GData.YouTube; using Google.GData.Extensions.MediaRss; using Google.YouTube; namespace Youtube_Manager { public partial class...

Show paused Timer value in Label

I've created a C# windows form application that uses a timer to clear the input boxes every 5 minutes. There is a label called lblTime that displays the amount of time elapsed at any given point while the application is open. I would like to be able to disable or...

How to make inherited form full screen [on hold]

I am having some trouble trying to get a windows form project go full screen and to hide the taskbar. I am inheriting forms from a master form. When I add the following code it still shows the task bar at the bottom. this.TopMost = true; this.FormBorderStyle = FormBorderStyle.None; this.WindowState...

Custom Numericupdown

I'm trying to create a custom numericUpDown control. I'm trying to add text to the numericUpDown and I got it working good. But, now I want to find a way to select only the number when clicking in the control, because at this moment when I "edit" the value manually,...

Managing per form ObjectContext lifetime

For ORMs like EF and NHibernate, multiple places suggest using "context per method" (or per request, per transaction) for web apps and services and using "context per form" for thick clients like WinForms and WPF. In C#, resource disposal with context per method is clean and clear with a using...

how to remove a row from datatable

I'm trying to remove/delete 1 row from datatable which has 100 rows like this: Form1.dt.Rows[i].Delete(); Form1.dt.AcceptChanges(); but further down when i get the count of the rows of the table like : int rc = Form1.dt.Rows.Count; the rc still returns 100! does Form1.dt.Rows[i].Delete(); clear the row and leave it empty...

SaveFileDialog not displaying

EDITED CODE/QUESTION. BEGININVOKE IS NOT LONGER ON THE TABLE. I'm having trouble getting a SaveFileDialog to show its dialog. When I call ShowDialog normally I get no response at all. The code falls through and acts like the SFD was never called in the first place. I also tried running...

Adding data to DBF file adds column _NullFlags

Im currently working on a program that gets information from a sql database and creates a .DBF that has the information in there. I got it to the point where it makes the file and adds the columns/rows. But every time I run it, it adds a column named _NullFlags...

How to make if statement that checks if multple listBoxes are empty or not?

How do I make an if statement that asks if multiple listBoxes are empty or not? This is what I have so it possible to combine it into one single if statement? if (listBoxEmails.Items.Count < 1) { //Perform action } if (listBoxWebsites.Items.Count < 1) { //Perform action } if...

Form controls not showing

I'm making a console application that shows a form. I created the form from scratch. When I run the program, the form shows, but the controls I added don't show. My code: using System; using System.Windows.Forms; using System.Drawing; namespace form { public class main { public static void Main() {...

Comparing DataGridView values

I have a WinForms application in C # that registers support tickets in a DataGridView, each ticket has a status, which may be pending or completed. I want to implement a method to validate if a ticket is completed, then this record can not be modified. What i tried was...

C# Windows Form Application - value not printing in textbox for each time

Value not printing in textbox for each time.. Iam able to see last value only (10) in textbox. private void button1_Click(object sender, EventArgs e) { for(int i = 0; i<=10; i++) { textBox1.Text = i.ToString(); Thread.Sleep(100); } } ...

Share config between UI and service

Is there a way to deserialize user.config in a different assembly? I need a form bound to Properties.Settings and then a service accessing these settings. I've tried ConfigurationManager which loads the config fine, but there seems to be some kind of protection keeping the userSettings section out of my reach....

Why i'm getting exception StackOverFlowException ? And how to solve it?

I added a new form in form1 i have a button click event: private void button1_Click(object sender, EventArgs e) { UploadTestingForum utf = new UploadTestingForum(); utf.Show(); } And the new form code i took from example here: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;...

How do I keep previously painted objects from disappearing when a new one is creating in a Windows Form Application?

My problem is that within my Windows Form Application, I want to draw an Ellipse everytime the mouse is clicked within a specific picture box, and I want the previously drawn ellipses to remain present in the picture box. In its current state, once the mouse is clicked, the previously...

Application is missing required files

Pic of Error: Cannot Download the Application. The Application is missing required Files. Contact Application Vendor For Assistance. So I'm building a windows form application using SharpDevelop 5.2 and I'm trying to make a standalone/version someone else would be able to use on another machine. In sharpdevelop (and visual...

How can i put formclosing event in Button

i make this button btnCallenge and i want if the person click on it the form can't be closed if he try to close it i want the form cant be closed if the user click on chellange button public void btnChallenge_Click(object sender, EventArgs e) { } private void Form1_FormClosing(object...

DialogBox with value verifications

For my application which deals with graphics, I've made a little DialogBox to set: Max; Min; Major Step (of the scale); Minor Step. Here's a screen capture: I want to validate a few things before allowing the user to click Ok: Max >= Min MaxScale >= MinScale. But it's not...

Why when adding items to combobox it's adding the same item many times?

In the top of form1: public class ComboboxItem { public string Text { get; set; } public object Value { get; set; } public override string ToString() { return Text; } } List<string> results = new List<string>(); Then: ComboboxItem item = new ComboboxItem(); var result = videoCatagories.Execute(); for (int i...

Value cannot be null when deserializing JSON

I have a db table which has column in which content is stored in JSON format, I am retrieving JSON but I am getting this error. Value cannot be null Here is my code snippet. var stuff = (JObject)JsonConvert.DeserializeObject(commentId); string name = stuff["Name"].Value<string>(); string email = stuff["Email"].Value<string>(); string company =...

Serialize/Deserialize class containing byte array property into XML

My data class that will be serialized into XML look like this: [XmlType(TypeName = "SPCFileInfo")] [Serializable] public class SPCFileInfoProtocol { [XmlElement("CompanyCode")] public string CompanyCode { get; set; } [XmlElement("FileName")] public string FileName { get; set; } [XmlElement("FileVer")] public int FileVer { get; set; } [XmlElement("FileSize")] public long FileSize { get;...

How can i display long units in MB and also displaying percentages progress in a progressBar?

I have this line: backgroundWorker1.ReportProgress((int)obj.BytesSent); BytesSent is a long var. I needed to cast it to (int) to report it. And now in the backgorund1 progresschanged event i want to display it as MB. For example 0.3MB 0.7MB 33MB instead displaying Bytes. private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { toolStripStatusLabel2.Text...

CEFSharp Winforms display a loadin message while the website loads?

Am using Cefsharp 39.0.0 to load a webpage inside a winform. Now while the page loads the form is blank. How do I show a loading gif? public Browser() { InitializeComponent(); string clientURL = ""; ChromiumWebBrowser browser = new ChromiumWebBrowser(clientURL); browser.Dock = DockStyle.Fill; toolStripContainer.ContentPanel.Controls.Add(browser); browser.RegisterJsObject("camera", new Camera()); } I looked...

Properly display list of custom objects in Windows Forms' Property Grid

I'm trying to display the properties of my Wall class in a properties grid. Right now my wall class looks like this: [TypeConverter(typeof(ExpandableObjectConverter))] public class WallType { #region _private variables and Properties public string Name { get; set; } //Name of the wall to identify it. For the wall program,...

How to use XDocument to get attributes and add them to a List

I am trying to load data from an XML file and add it to a List. The XML file looks like this: and this is my code: public void LoadPayments(List<List<string>> list1, List<List<string>> list2) { try { if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RentData.xml"))) { int count = 0; XDocument doc; using (var reader =...

Dialog Form Closes After Error

Calling the Subform: using (Form2 addEmp = new Form2()) { DialogResult dr = new DialogResult (); addEmp.FormBorderStyle = FormBorderStyle.FixedDialog; dr = addEmp.ShowDialog(); if (dr == DialogResult.OK) { retrive = addEmp.GetEmployee; addtoTextFileCombo(retrive); } } private void btnAdd_Click(object sender, EventArgs e) { try { iD++; this.GetEmployee = new Employee(iD, txtFirstName.Text, txtLastName.Text, txtEmail.Text);...

How to create a folder that contains the current date and time instead of name

I use C++ Windows Form application in Visual Studio 2013 for one project. I wonder how to create a folder that contains the current date and time instead of name? It is possible to make such folder?? DirectoryInfo^ directory = Directory::CreateDirectory("C:\Users\Desktop\" + ??); ...

Is it possible to login from a winforms application to a website which uses spring security?

I want to call a web service from my winforms application. My application is written on c# and the webservice is secured using spring security. Is it possible to login to the website and call that web service?. If it is possible how to do that?...

Why does this code to replace accented chars with html codes fail to work?

I want to replace accented chars (such as á, ñ, ¿, ¡, etc.) with the corresponding HTML codes (such as á, ñ, ¿, ¡, etc.). For example, this line of text: Imposible me ha sido rehusarme á las repetidas instancias que el Caballero Trelawney, el Doctor Livesey y otros muchos...

Check whether print command success or not

I am printing some PDF files through c# code. My code looks like this myPrinters.SetDefaultPrinter(pdfPrinterName); var info = new ProcessStartInfo { Verb = "Print", FileName = file, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }; var p = new Process { StartInfo = info }; p.Start(); p.WaitForInputIdle(); System.Threading.Thread.Sleep(18000); if (!p.CloseMainWindow()) p.Kill();...

How to change background Color of label full length when Mouse Hover in c#

I can't Select label back Ground color Mouse Hover event in full length,only can select The Word length I would like to get log out background same like username background as full width private void label5_MouseHover(object sender, EventArgs e) { this.LblChange.BackgroundImage = null; this.LblChange.BackgroundImage = global::Flex.Properties.Resources.Mail1; this.LblChange.BackColor = Color.Blue; this.LblChange.BackgroundImageLayout...

getting keyboard input in winform listbox

i am altering a program so that a listbox picks up keyboard input (number pad, D0-D9, letter keys) and edits properties of the currently selected listbox item based on the input. my problem is that there seems to be no functionality that can convert a key press into a letter....

MVP in WinForms ( presenter & program.cs)

I'm learning an MVP pattern and have the following issues: If I have one form(project MainForm), one model(project Model) and one presenter, should I create a new project for my presenter or it's ok to put it in MainForm project? 1)If presenter must be located in separate project, it obviously...

Copying CMD output to clipboard

I'm trying to copy output from a program running out of the CMD prompt to the Windows clipboard. private void button1_Click(object sender, EventArgs e) { /*Relevant Code*/ Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "cmd.exe"; p.StartInfo.Arguments = String.Format("/k cd {0} && backdoor -rt -on...

Getting Multi Rows in Database and transferring it in a multiline textbox in WinForms

Here in my code, i have a database which has table of my applicants. As you will see in the code below, i want to get the number of rows from my command text and transfer it to the string "abc" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...

Dynamically Resizing Controls on Windows Forms

I has a winform which can be resize. I has 4 chart control in the form and sit side by side. When the form is in maximum size, the layout of each chart control is run out. I try to set the anchor style but i got no luck. How...

Improve DataGridView rows managing

SCENARIO I'm manually filling a DataGridView with a DataGridViewRow collection: I created the columns at design time in the GUI builder of Visual Studio. First column takes an Integer value, its a DataGridViewTextBoxColumn. Second column takes an Icon object, its a DataGridViewImageColumn. Third column takes a String value, its...

Updating a list of objects bound to a DataGridView from a popup form

I seem to be having a bit of a problem with returning the updated information on my edit button placed on the popup form, back to my DataGridView (which is bound to a list of objects) on the original form. I seemed to have it working the other day, however,...

Notify winforms application by Sql Server database changes

I created a Sql server database, in which I added a table named user. Then I executed this script ALTER DATABASE [TestNotification] SET ENABLE_BROKER I'd like to use SqlDependency class to notify a winforms application when the user table were changed. namespace Watcher { public partial class Form1 : Form...

How do I prevent any button click events from queuing until the event handle is finished with the first call

I want to prevent a button click from queuing. In testing I have a Form, a Button and in the Code-Behind I have the event handler: private void button1_Click(object sender, EventArgs e) { if (_codeRunning) return; _codeRunning = true; //Application.DoEvents(); //button1.Enabled = false; _click ++; Debug.WriteLine("Click Number: " + _click);...

Move windows form from a picturebox in C#

I have a windows form without any border. So i added a picture box and i want the whole form to be moved when that picture box is clicked. public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 0x2; [DllImportAttribute("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg,...

Unable to bind data to DataGridView by using BindingList in WinForm application

I am reading data from excel file (.csv) and storing that data to List<String>. I want to display this data to DataGridView but for some reason I am seeing total length of String in Grid. Following is my code : CODE: private void btnImportFile_Click(object sender, EventArgs e) { OpenFileDialog dialog...

Load all user controls of a form on start

My Winform application has a main form with a tab control. In each tab there is a User Control. And each user control has Controls (such as DataGridViews, etc) that are loaded on the Load event of the user control. The problem I have is that I would like to...

If and only if in 4?,if-statement,.net-4.0
IIF seems to be unavailable in .net 4, do we have a replacement? IIf(condition = 0, True, False) Would be a simple if statement a good replacement?...

I'm getting exception Cross-thread operation since i'm using ui var in a thread operation how should i handle it? [duplicate]

This question already has an answer here: Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on 12 answers I have this progress changed event: private void videosInsertRequest_ProgressChanged(IUploadProgress obj) { toolStripStatusLabel1.Text = obj.Status.ToString(); } And also this event: private void videosInsertRequest_ResponseReceived(Video obj)...

Set Label From Thread,multithreading,winforms
Form1.vb Imports System.Threading Public Class Form1 Dim demoThread As Thread Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Start As New Class1 Me.demoThread = New Thread( _ New ThreadStart(AddressOf Start.ThreadProcSafe)) Me.demoThread.Start() End Sub Delegate Sub SetTextCallback([text] As String) Public Sub SetText(ByVal [text] As String) ' InvokeRequired required...