|
I have created an On-screen-Keyboard as a WPF user control.
This WPF user control works fine (whenever i press a button,the text goes to the focused element) when used in a WPF application.
But when i use this WPF usercontrol in a Winform application using elementhost.child, the text doesnot go to any focused element in winform.
How do i route the OSK text content[when i press any key..i.e. button] to any focused element[eg: textbox] in winform?
|
|
|
|
|
Hello Friends,
I am not able to set the cell value of datagridview on cell double click.
here is the code on cell double click :
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).value = "TEST"
It is giving System.Data.ReadOnlyException.
Thanks & Regards,
Rahul
rahul saini
|
|
|
|
|
What is the DataSource for the DataGridView ?
What is the full error message?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Henry,
I am using DataGridView and bind it with DataTable.
Error Description:
DataGridView column bound to a read-only field must have ReadOnly set to True.
above error comes on this statement:
GV.Columns(e.ColumnIndex).ReadOnly = False
==================other error:============
this error occur on :
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).ReadOnly = False
GV.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = "text"
DataGridView Default Error Dialog
The following exceptions occurred in the DataGridView
System.Data.ReadOnlyException: Column 'Status' is Read only
at System.Data.Datarow.set_Item(DataColumn column, Object value)
at System.Data.DatarowView.SetColumnValue(DataColumn Column, Object value)
at System.Data.DataColumnPropertyDescriptor.SetValue(Object Component, Object value)
at System.Windows.Forms.DataGridView.DataGridViewDataConnection.PushValue(Int32BoundColumnIndex,
Int32 columnIndex, Int32 rowIndex, Object value)
To replace this default dialog please handle the DataError event
Regards
Rahul
rahul saini
|
|
|
|
|
then clearly the problem is that the column in the DataTable is readonly, so presumably it is in the underlying database. Trying to change the ReadOnly property in your DataGridView cannot possibly alter this.
You have to investigate, and find out why the underlying data is readonly. DataColumn has a ReadOnly property and maybe this is being set to true somewhere else in your code.
There are loads and loads of possible reasons, but from the error message, it clearly is not the DataGridView that is causing the problem.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Hi,
I would suggest that you use a stored procedure like below.
CREATE procedure pr_Insert_image
@ImageName as varchar(20),
@Image as image
as
if not exists (select * from tblimages where ImageName =@ImageName )
begin
insert into tblimages(ImageName ,Image)values(@ImageName ,@Image)
end
To convert an image in .Net you could do this like below
Dim objImageB As System.Drawing.Image
objImageB = Drawing.Image.FromFile(Server.MapPath("~/images/no-photo-Available.jpg"))
|
|
|
|
|
bluepoison wrote: objImageB = Drawing.Image.FromFile(Server.MapPath("~/images/no-photo-Available.jpg"))
It is a windows application and not a web application.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
still could not figure it out is this impossible
|
|
|
|
|
Hi all,
I want to make something like the Visual Studio start page appear in a MDI child in my winforms app. I know about using WebBrowser control, and I know about SharpDevelop (but I am not looking to do something as complicated as it). I have a WebBrowser docked to fill my form's client area and I want to display a webpage in it that's also an ASP web form, so I can list the user's recently used files and allow them to run commands by clicking on links etc., just like Visual Studio. But I want the web page to be embedded in my application's resources so I don't have to drag a copy of it around on disk to ship with my app.
How do you do such a thing, and also get referenced images in <img> tags to come out right?
TIA
Brian
|
|
|
|
|
Hi,
you can tell a WebBrowser to navigate to a URL, or a file, or you can feed it a string corresponding to the page content; see the DocumentText property. Just put everything from <html> to </html> in one big string, which you may or may not store as a resource inside your app.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Good answer, and I've already thought of that. What I am having a problem with is images, say, via the <img> tag in my HTML and I reference a file also in my resources. It's not working when I call up the HTML in the WebBrowser . I have, e.g., a file called studioheader.png in my resources, and the HTML I load (through the WebBrowser.DocumentText property) is, just as a simple example:
<html>
<head>
<title>Start Pagestudioheader.PNG is in my Resources. The very same HTML is loaded into the WebBrowser.DocumentText property on Form_Load event, but when I bring up the form in my app, the WebBrowser control does not display the image. I don't want to put the image on some server somewhere; I want to bundle it with my application resources, so I can depend on it always showing up, no matter where my app is installed.
Sincerely Yours,
Brian Hart
|
|
|
|
|
Hi Brian,
there is a solution to that, not a very simple one though. It basically consists of embedding a web server into your application, and letting your WebBrowser show actual pages originating from that web server. The complexity depends on the features you would want; just delivering files should be very easy (remember, each image just causes another HTTP GET request to the server, and gets answered by sending the image file). Things would become real complex if you want to handle forms, AJAX, etc.
I trust CodeProject holds some decent articles on the subject, maybe tthis one[^] could help.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I have a small app I wrote last year that opens 3 work-related web pages in separate tabs. Never had a moment's trouble until today. For no apparent reason the WebBrowser control no longer navigates. I get a "Navigation to web page was canceled" message. IE and FireFox are both working fine. Good strong Internet connection. If I set the WebBrowser to open in a new window, IE opens as expected and navigates to the proper page. My control's AllowNavigation property is still set to True.
The code below is from a test app I wrote to see if the problem was unique to my application, but it doesn't work either.
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
WebBrowser1.Navigate(txt.Text)
End Sub
If I change the Navigate statement to WebBrowser1.Navigate(txt.Text, True) it opens IE and goes to the desired page. Anyone have an idea? The program was working fine before and I've made no changes, so I'm a bit stumped.
|
|
|
|
|
|
I am using an HP, but the solutions offered from the search (both Google and Yahoo) were specific to a popup window displaying the "Navigation to the webpage was cancelled" message. Both IE and FF are working okay and the two tasks listed in the solutions are not present on my machine. Only the VS WebBrowser control is affected.
The only new thing I've done with VS lately is the addition to the toolbox of a 3rd party edit control (ScintillaNet). The control is not used in this project however and I can't imagine how it'd affect the WebBrowser (although my imagination is somewhat limited).
Stumped in Mississippi
|
|
|
|
|
Hi Alan,
I just experimented with a WebBrowser and it works as I would expect (Vista, IE7, .NET 2.0), e.g. navigating to "www.google.com".
Did you recently upgrade your IE (WebBrowser is or uses parts of IE)?
And does it fail on all kinds of URLs?
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Haven't upgraded lately. The WebBrowser fails with every url I try.
Also, the failure is immediate. There is no long pause as though it's trying to load (like with a weak WiFi signal). I get the "Canceled" message in 1 or 2 seconds.
Is it possible that the application can't connect for some reason?
|
|
|
|
|
Alan Burkhart wrote: Is it possible that the application can't connect for some reason?
I'm sure there is, but I'm not aware of any.
What is the exact symptom? are you getting an exception? if so, I suggest you look at Exception.ToString(), which shows all the available details (as opposed to Exception.Message).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Not getting any exceptions. Just the browser message.
Using slightly different code in test app, and now the message is "This program cannot display the webpage."
Public Class Form1
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Try
WebBrowser1.Navigate("http://www.google.com/")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
txt.Text = WebBrowser1.Url.ToString
End Sub
End Class
|
|
|
|
|
Any chance you have a FireWall blocking your app completely?
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Found a suggestion: in IE(7) goto Tools/Internet Options/Advanced/ and uncheck "Show friendly HTML error messages", then try again to see the real problem.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Same result.
But... I just discovered that my Norton is shut down and won't run. Could be a related security issue. When I try to start Norton I get a little dialog thanking me for being a Norton BETA tester (never been one).
I'm off to grab the AVG freebie until I get Norton figured out. Perhaps the two problems have a common root? Stranger things have happened.
Will post back here when I'm done.
Thanks!
AB
|
|
|
|
|
It was Norton. The whole program was messed up and I had to reinstall. Now it's running fine, and the WebBrowser control is loading pages as it should.
Thanks so much for taking the time to help and have a great weekend when it gets here!
AB
|
|
|
|
|
You're welcome.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|