|
Not sure if this is what you are looking for. The following example shows some of my code I've used where I have a timer event handler function call this piece of code every second. Without the if statement this would cause problems because the page doesn't always load in the browser at the same speed - it will make the program stop responding. But with the if statement this checks and makes sure the WebBrowser object is not loading anything at the moment and if it is, it doesn't execute the code (doesn't load anything else - until the statement is true):
if (webBrowser1.IsBusy == false && webBrowser1.IsOffline == false)
{
webBrowser1.Url = new Uri(strUrl);
}
Let me know if I can help further.
|
|
|
|
|
Hi peshkunta,
After InvokeMember (new in .NET Framework 2.0) ->
IsBusy = false
IsOffline = false
that's the problem (tested with your code above as check process)
InvokeMember fire a method of the selected HTML element. I loaded a FORM tag and after submitting it, a new webpage is loaded again.
But if I am in debugging mode and go to the line after InvokeMember I wait a moment and then it works, because the browser don't fire the flag immediately.
|
|
|
|
|
???
i need to capture these events as i have a statusbar on my app, and when i maximize my app it retains the sizing grip and if u click-grab it moves through out the page...so i need to capture the maximize/minimize events to beable to hide/unhide the sizing grip...unless there is a better option out there...
|
|
|
|
|
|
thx
it works beautifully
thx again
|
|
|
|
|
I need to allow an administrator to change login passwords for my application but am having problems with the syntax for the UPDATE statement. Specifically, I want to use Data Commands rather than working through a data set to make the updates because I will only need to do two operations with the MS Access database-verifying the old password/user id combo and updating the password to a new one. It seems to me that the UPDATE statement requires paramaters, but I am unsure of the syntax. Any help would be appreciated. Thanks.
|
|
|
|
|
The syntax for the SQL command you will need is easy:
UPDATE [table] SET [field]=[value],[field]=value,.. WHERE [filterexpression]
Replace the [...] for the actual names and values.
For the rest you need a simple piece of code like this:
OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=mydb.mdb");
OleDbCommand cmd = new OleDbCommand(query,connection);
try {
connection.Open();
cmd.ExecuteNonQuery();
}
catch {
}
finally {
connection.Close();
}
Good luck.
WM.
What about weapons of mass-construction?
|
|
|
|
|
If you were working thru a dataset you would not have to know any SQL statements after populating the dataset.
Using the dataset is simple
1> create and fill the dataset with dataAdapter.
2> create new SQL command builder associated with dataAdapter
3> get new row from DataTable edit row(record) - (user/password)
4> simply update the database thru the adapter
Besides from initially populating the dataset no SQL involved
|
|
|
|
|
Hi, can someone help me...??
I have data in a Access-database, i add the data to a arrayList and show the data from the arrayList in a dataGridView. All that works perfect.
Now i want to add data to the arrayList (and then to the Access-database).
I want to use the dataGridView, so i clear it by: dataGridView1.Rows.Clear();
Then i would like to add data to the empty rows and press a Save-button to save the data.
I have tried something like this:
foreach (DataGridViewRow gridRow in dataGridView1.Rows)
{
KampListe.Add(new Kamp(Convert.ToString(gridRow["kampnr"]), Convert.ToString(gridRow["Idrætsgren"]), Convert.ToString(gridRow["Turnering"]), Convert.ToString(gridRow["Dato og Tid"])));
}
but it will not work...., what is the problem...???
Helge
|
|
|
|
|
ArrayList listing = new ArrayList();
int i;
for (i=0;i<=dataGridView1.Rows.Count -1;i++)
{
listing.Add(i.ToString());
}
check this link too
http://blog.kevinsmet.be/PermaLink,guid,22de02a3-2fc8-482a-99f9-c5f293a41c79.aspx
|
|
|
|
|
Hi again, i can still not solve my problem...
In my dataGridView1 i have 9 coloumns, how do i get each cells value in all 9 coloumns...???
Helge
|
|
|
|
|
ArrayList listing = new ArrayList();
int i;
for ( i=0;i<=this.dataSet11.Tables[0].Rows.Count - 1;i++)
{
listing.Add(dataSet11.Tables[0].Rows[i]["column1"].ToString()); listing.Add(dataSet11.Tables[0].Rows[i]["column2"].ToString()); listing.Add(dataSet11.Tables[0].Rows[i]["column3"].ToString()); listing.Add(dataSet11.Tables[0].Rows[i]["column4"].ToString());
listing.Add(dataSet11.Tables[0].Rows[i]["column5"].ToString());
listing.Add(dataSet11.Tables[0].Rows[i]["column6"].ToString());
listing.Add(dataSet11.Tables[0].Rows[i]["column7"].ToString());
listing.Add(dataSet11.Tables[0].Rows[i]["column8"].ToString());
listing.Add(dataSet11.Tables[0].Rows[i]["column9"].ToString());
}
i have done this in windows application, but i havtn free time to write in web app but i hope helps as clue...
|
|
|
|
|
Hello.
How can I fire up a button event without pressing the button?
Thank you
|
|
|
|
|
private void button1_Click(object sender, System.EventArgs e)
{
//Do some code
}
private void timer1_Tick(object sender, System.EventArgs e)
{
this.button1_Click(this,e);
}
ur code which is written in click event of button should execute in everey seconds,minutes,hours,... by timer whithout clicking button
but first set property to true of timer in design view or in form1_load
example :
timer1.enabled=true;
hope helps
|
|
|
|
|
You can event try calling button1.PerformClick() method.
Thanks,
VPMahank.
|
|
|
|
|
Something like
<br />
private byte[] getImageBytes()<br />
{<br />
byte[] buffer = null;<br />
FileStream templateStream = File.Open(@"C:\MyImage.gif", FileMode.Open);<br />
buffer = new byte[templateStream.Length];<br />
templateStream.Write(buffer, 0, (int)templateStream.Length);<br />
templateStream = null;<br />
return buffer;<br />
}<br />
The code runs but I only get a buffer containing zero's
Thanks
Thomas
|
|
|
|
|
Try flushing the file stream (and also, you MUST dispose the FileStream as well). Setting it to null is pointless; you only need to do that in Java.
private byte[] getImageBytes()
{
byte[] buffer = new byte[templateStream.Length];
using(FileStream templateStream = File.Open(@"C:\MyImage.gif", FileMode.Open))
{
templateStream.Write(buffer, 0, (int)templateStream.Length);
templateStream.Flush();
}
return buffer;
}
Please note that if you're using the latest version of the .NET framework, you can use the File.ReadAllBytes method, which is more efficient and requires only a single line of code:
private byte[] getImageBytes()
{
return File.ReadAllBytes(@"c:\MyImage.gif");
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
|
|
Judah Himango wrote: Setting it to null is pointless; you only need to do that in Java.
OT, but I thought the Java GC also worked the same way as .NET, it's mark and sweep and doesn't require references to be set to null?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
In Java, this is a common way of letting the GC know you're done with it. With .NET, it isn't needed. I believe the Java GC would eventually clean up objects even if they weren't set to null, but doing so would supposedly help it along.
|
|
|
|
|
Thanks, just one thing that was horrably wrong, it should be
templateStream.Read(buffer, 0, (int)templateStream.Length);
by using the templateStream.Write(...) it zero's out the image
so it should be
<br />
private byte[] getImageBytes()<br />
{<br />
byte[] buffer = new byte[templateStream.Length];<br />
using(FileStream templateStream = File.Open(@"C:\MyImage.gif", FileMode.Open,FileAccess.Read)) <br />
{<br />
templateStream.Read(buffer, 0, (int)templateStream.Length);<br />
templateStream.Flush();<br />
}<br />
return buffer;<br />
}<br />
<br />
|
|
|
|
|
thomasa wrote: templateStream.Write(buffer, 0, (int)templateStream.Length);
You should be reading from the file, not writing. Anyways your file is blank now, so you will have to create the image, else you will carry on getting zero's.
xacc.ide-0.1.1 released! :) Download and screenshots
|
|
|
|
|
Like leppie said:
FileStream templateStream = File.Open(@"C:\MyImage.gif", FileMode.Open);
buffer = new byte[templateStream.Length];
templateStream.Write(buffer, 0, (int)templateStream.Length);
Shouldn't that be READ??? In either case, the file has already been destroyed when you ran this code for the first time. You'll have to correct the code to Read, then replace the .GIF file with a known good copy.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi.....
Im workin on Icon class where im gettin this exception at the declarartion of the icon obj
private Icon myIcon= new Icon(typeof(Form1)).Assembly.GetManifestResourceStream("winapptry.app.ico" ));
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
with additional info as
Additional information: Could not find file "..\Visual Studio Projects\winapptry\bin\Debug\winapptry.app.ico".
just dunno how to sort tht out
sathy
-- modified at 8:15 Wednesday 28th December, 2005
|
|
|
|