|
well then you need to use memory stream as the source for the browser to read the html contents, but im not sure about this that either browser will read from this memory stream or not
what else can be done is you embed the browser control (if IE) in your application and then try to send html text to that browser control programmically
---------------------------
http://www.idlsol.com
|
|
|
|
|
memory stream!!
what do u mean by memory stream?
|
|
|
|
|
|
I read it, thanks, but there is a problem for using memory stream as a solution : how i can bind a memory stream file to a web browser??!!!
|
|
|
|
|
If you want to load HTML file in a webbrowser control, Its the straight forward way to set the property value of DocumentText of the Webbrowser with the HTML string.
Example,
If your Webbrowser control has instance name, webBrowserControlMyBrowser then
string htmlString = " Hello World ";
webBrowserControlMyBrowser.DocumentText = htmlString;
In this way, You dont need to create a file, save and delete etc, moreover, you dont even need to wait for couple of seconds to load. Its the DIRECT way.
Emran
|
|
|
|
|
Thanks. but im working with VisualStudio.net 2003, and this property "DocumentText" is not valid for web browser control!!!
Salmani
|
|
|
|
|
|
I tried all of them before, i searched all of sites and MSDN library , but i couldnt find it !
|
|
|
|
|
Hi
I please follow thease steps, I think it'll help you to solve the problem
first of all create a Windows application
drop a WebBrowser on form1 (leave the name webBrowser1)
change the Url property to about:blank
drop a button
double click on the button1 and paste this code for event handler
<code>
private void button1_Click(object sender, EventArgs e)
{
System.IO.MemoryStream st = new System.IO.MemoryStream ();
string sampleHtml = "<html><body>Hello world! </body></html>";
UTF8Encoding uniEncoding = new UTF8Encoding();
byte[] firstString = uniEncoding.GetBytes(
sampleHtml);
webBrowser1.DocumentStream = st;
st.Write(firstString, 0, firstString.Length);
st.Flush();
st.Position = 0;
webBrowser1.DocumentStream = st;
}
</code>
Ahmadreza Atighechi
|
|
|
|
|
Hi
Please do the following steps, I think it'll help you
Create a new windows application
Drop a WebBrowser Control to Form1 (leave the webBrowser1 as name)
change property Dock to none
change the property Url to about:blank
drop a button to form1 (leave the button1 as name)
bouble click on the button1 and paste following code as event handler
<code>
private void button1_Click(object sender, EventArgs e)
{
System.IO.MemoryStream st = new System.IO.MemoryStream ();
string sampleHtml = "<html><body>Hello world! </body></html>";
UTF8Encoding uniEncoding = new UTF8Encoding();
byte[] firstString = uniEncoding.GetBytes(
sampleHtml);
webBrowser1.DocumentStream = st;
st.Write(firstString, 0, firstString.Length);
st.Flush();
st.Position = 0;
webBrowser1.DocumentStream = st;
}
</code>
Ahmadreza Atighechi ..:--::..
|
|
|
|
|
No, It was implemented in VS 2005, I've just see that you use VS 2003 in some previous messages
Ahmadreza Atighechi
-- modified at 8:31 Saturday 27th May, 2006
|
|
|
|
|
there are another problem !!!
in this method , how can i show images that there were in html source ??
i see : about blank ../../images/sx.jpeg with right click on picture in web browser .so what can i do??
|
|
|
|
|
I finally find out!!
object empty = System.Reflection.Missing.Value;
axWebBrowser1.Navigate("about:blank", ref empty, ref empty, ref empty, ref empty);
mshtml.IHTMLDocument2 doc = axWebBrowser1.Document as mshtml.IHTMLDocument2;
doc.clear();
doc.writeln("This is my text...");
doc.close();
doc = axWebBrowser1.Document as mshtml.IHTMLDocument2;
doc.execCommand("Print", true, 0);
|
|
|
|
|
there are another problem !!!
in this method , how can i show images that there were in html source ??
i see : about blank ../../images/sx.jpeg with right click on picture in web browser .so what can i do??
|
|
|
|
|
I am creating a new window app and am having difficulty with resetting focus to a form instead of opening multiple instances of the form. I have a menu to open formA for example from the MainForm menu. I want to have the logic be something like (from click of menu from MainForm)
If formA visiblity == true then
{ set focus to formA}
else
{ formA.show}
I can't seem to get the syntax for the if condition and the set focus command back to formA if it is already open.
Any help would be appreciated, thanks!
-- modified at 1:07 Saturday 27th May, 2006
|
|
|
|
|
if (formA.Visible == true)
{
formA.Select();
}
else
{
formA.Show();
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
I tried this but still it does not function correctly. If formA is not visible then it open a new instance no problem. the problem is if I go back and try and open it again, instead of selecting the previously opened form, it opens a new instance via formA.Show() even though copy of formA is open.
If I change visible == true, then it believes an instance is already opened even though one is not opened.
if (formA.Visible == false)
{
// shows new formA form
formA.Show();
MessageBox.Show("New Form");
}
else
{
// Reset focus to currently opened form
formA.Select();
MessageBox.Show("Reset Focus to form");
}
|
|
|
|
|
IMC2006 wrote: I can't seem to get the syntax for the if condition
It looks like you partially wrote it in VB
The syntax for the if statement is:
if ()
{
}
else
{
}
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
if(formA == null)
{
formA = new FormA();
}
if(!formA.Visible)
{
formA.Show();
}
formA.Focus();
|
|
|
|
|
Hi,
In my form one datagridview control is there,insert button When we click on insert a new row is added to the datagidview.If we enter values in that new row and click on save button ,the newly inserted row is updated to database.To get this what code i have to write in save button click.
Please help me.
Thanks in advance
|
|
|
|
|
first you must set the gridview DataSource:
dataGridView1.DataSource =DS.tables["x"];
then u must add row to the DataTable for exmaple :
a = a+1;
b = textBox1.Text;
dt.Rows.Add(new object[] { a, b});
after click the button to update data in database:
scb = new SqlCommandBuilder(DA);
DA.Update(DS, "tbhazine");
|
|
|
|
|
Hi,
Thank you very much for your response.
|
|
|
|
|
Hi all,
I'm looking for some information about how to transform bmp images in GDI+. The operations I need to perform are: contrast, brightness, gamma correction etc...
Could anyone direct me at some sources concerning that matter? I understand I need to have some kind of transformation matrices to apply on the original image, but I'm not familiar with the mathematics behind such transformations.
Thanks,
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
YOu need to do a search on my surname in this site, and you'll find a whole series of articles on the subject.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Many thanks, found some articles (in VB.NET mainly) that I need to read thoroughly.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|