|
|
Hi,
I wrote the program as mentioned above. However I used the event DocumentComplete instead of DownloadComplete. It is working fine if new URL is given in the browser window. But if Refresh button of browser is clicked, then DocumentComplete event is not getting fired. However DownloadComplete event is getting fired. But DownloadComplete event does not give me the WebBrowser object for which the event is fired as it is available in the DocumentComplete event. Is there any way in this function to get the instance of WebBrowser from which this event is fired?
Thanks in advance.
Regards,
Sunil
|
|
|
|
|
Hi there, C# experts!
I have a (in my view actually simple) problem:
In my application I want to wait for a predefined timespan and show this to the user via a progress bar. However, I want to call the waiting method from my business logic class rather than from my GUI class. Therefor I use following simple code:
public void Wait4Something()
{
// Timespan we want to wait...
int Wtime = 60;
// myBar is the progress bar owned by the form.
// "this" is NOT the form but a motor class
// driving the form and driven by form events.
if( this.myBar != null )
{
this.myBar.Value = 0;
this.myBar.Maximum = Wtime;
this.myBar.Step = 1;
}
this.myGUI.Refresh();
for ( int i = 0; i < Wtime; i += 1 )
{
this.SomeOtherObject.Wait4BroadcastReply( (uint) 1000 );
this.myBar.PerformStep(); // Proceed with the progress bar
this.myGUI.Refresh(); // <- this does not do apparently
}
if( this.myBar != null ) this.myBar.Value = 0;
}
However, if I let the code run, everything is fine until I hit [ALT]-[TAB] to swap windows and then hit it again to swap back to my app.
By then, the GUI freezes, shows the hourglass and does not redraw or revalidate and the progress bar does not do steps either. After the specified waiting time, the control returns to normal and reacts to every event as expected.
I could probably dissolve the whole thing by starting a new thread, but i hoped not to get forced to do this for a simple visualization of waiting :/
Does anyone know of a feasible solution??
Thanks in advance for your regard,
Udo
"You can do it that way or that way. I like it that way."
|
|
|
|
|
An Application.DoEvents() call instead (or additional) to the Refresh could do the job. But note that you then probably have to disable the form because it will react to user input.
A seperate thread would be better...
|
|
|
|
|
Hi Robert,
thanks for your instant help, I was afraid of it but in the end it's probably best to do it right in the first place. So I'll be weaving some threads...
Thanks,
Udo
----
Anyway, Application.DoEvents() did help as a hotfix, and as I'm not doing anything mutual it's probably harmless to let the GUI react to user input, if not wanted. So thanks again for your very helpful advice!
|
|
|
|
|
I have come across with a little problem that must be simpler for you guys;
As a matter of fact, i m new in .Net/C# environment, hence i m facing a little bit difficulty in writing code.
I have a form (Non-MDI); on its next button after successfull execution of a method i have to open a new form and for doing this i have written the following code:
DBSecurity.DBSecurity msecure=new DBSecurity.DBSecurity(strServer,strUser,strPwd,strDatabase);
if (msecure.Generate(txtCompany.text,txtLocation.Text)==true)
{
SecurityGUI.frmGUI frm=new frmGUI();
frm.ShowDialog();
this.Close();
}
this code works fine as far as frmGUI form opening is concerned but it do not close the existing form and it still open on back.
Am i writing wrong code? or do you have another solution?
|
|
|
|
|
Hi,
in the .NET documentation about the Form class ShowDialog() method it says this:
"You can use this method to display a modal dialog box in your application. When this method is called, the code following it is not executed until after the dialog box is closed."
That means that the behaviour you describe is wanted. It's not a bug, it's a feature
Try the Show() method. That could be your solution.
Regards,
Udo
|
|
|
|
|
Try hiding your "parent" form instead and re-show it when you're done with the "child" (frmGUI) one:
SecurityGUI.frmGUI frm = new frmGUI();
this.Hide();
frm.ShowDialog();
this.Show();
This will work fine since after closing the child form, the applications' control will return to the line that immediately follows the ShowDialog() method.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
thanks Poils,
It works fine.
|
|
|
|
|
Hi
I have done a program in C# such that , added a crystal report viewer, then added a button named as browse… and designed a report by getting source from the xml schema file(.xsd file) with two fields namely name,image..... name is of string datatype and image is of
datatype base64Binary.. so now when I run the program.. using browse button I can be able to load a .jpg image at runtime.. so that image will be displayed in the report…. This is wht my program does…
Now what I have to do is that ,I should be able to load a .gif image at runtime and display in crystal report.At present when I select a .gif image..its not shown in crystal report…so please help me to do this.. I will enclose my coding part along with this..please have a look at it and help me to do this program….
and the coding is as follows:
// Prcocedure: AddImageRow
// reads an image file and adds this image to a dataset table
//
void AddImageRow(DataTable tbl, string name, string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open); // create a file stream
BinaryReader br = new BinaryReader(fs); // create binary reader
DataRow row;
// create a new datarow
row = tbl.NewRow();
// set country field and image field
row[0] = name;
row[1] = br.ReadBytes((int)br.BaseStream.Length);
// add this row to the table
tbl.Rows.Add(row);
// clean up
br = null;
fs = null;
}
//Browse button
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
// openFileDialog1.Filter = "Image Files(*.jpg) | *.jpg ";
openFileDialog1.Filter = "Image Files(*.jpg) |*.jpg | All Files(*.*) | *.*";
openFileDialog1.ShowDialog(this);
//the variable myPic contains the string of the full File Name,it includes the full path.
string mypic = openFileDialog1.FileName;
DataSet data = new DataSet();
// add a table 'Images' to the dataset
data.Tables.Add("Images");
// add two fields
data.Tables[0].Columns.Add("Country", System.Type.GetType("System.String"));
data.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]"));
AddImageRow(data.Tables[0],mypic,mypic);
// create a report
showimage cr = new showimage();
cr.SetDataSource(data);
// pass a reportdocument to the viewer
crystalReportViewer1.ReportSource = cr;
}
|
|
|
|
|
how can i read .dif file in asp.net using c#
darshan gandhi
|
|
|
|
|
Not enough information. There are currently 9 known uses for ".DIF" files in the FileExt database, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi friends,
Plz suggest me how can i implement checkboxes in listbox in Windows forms application. I want to use checkboxes to select items from the listbox. If possible, plz send me the code.....
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Look for a Windows forms' control called CheckedListBox in your toolbox instead
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks for ur reply. Have u any sample code in which u catch the checkboxes that are selected from the CheckedListBox?
I want to select multiple values from tha CheckedListBox....
Regards,
Sandeep
+919891027854
|
|
|
|
|
Yes, take a look below at the following self-explanatory code chunk. First I add three items into the checkedListBox , and then I get the text of the selected ones by looping through each one of them:
string <code>checkedItems </code>= "";
this.checkedListBox1.Items.Add("Item 1", CheckState.Checked);
this.checkedListBox1.Items.Add("Item 2", CheckState.Indeterminate);
this.checkedListBox1.Items.Add("Item 3", CheckState.Unchecked);
for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
{
if (this.checkedListBox1.GetItemChecked(i))
<code>checkedItems </code>+= this.checkedListBox1.Items[i].ToString() + "\n";
}
MessageBox.Show(<code>checkedItems</code>);
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanx senthil...It works...
If the same have to be done in treeview,i can add the firstline strings of the file as Nodes,
From the Nextline ,each element belongs a column..
That is...
"Tic","Tac","Toe"
"1","2","3"
"4","5","6"
Here...Tic ,Tac,and Toe are 3 sep columns and "1","4" belongs to Tic.."2","5" belongs to Tac and "3","6" belongs to Toe...
How to add those as "1","4"etc...as childnodes of "Tic"....
Am in urgent search for this kind of display...Kindly help me...
|
|
|
|
|
Hi, everyone.. I just started learning C# web application not long ago.. I like to enquire that if the user wants to logout of the web page/site, what is the code for the logout command when i click on the logout button?? Sorry as my question is too simple for you guys.. But thanks for the help..
Thanks
|
|
|
|
|
That all depends on what your using to handle logins. There is no one way of authenticating, tracking, and giving roles to users of your site. How you do the logout depends ENTIRELY on how you designed your authentication package, how your tracking your user sessions, what you need to do when the user logs out, or the session times out.
Without a LOT more detail about your security system, it's impossible for anyone to tell you how to code your logout. That is, other than dropping a button on a form and handling it's click event.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
As we all know that the Reflector can be used to show the code written by us in the dll provided by us.
I want to know some way which should block this.
i.d if a dll is given the code should not be displayed
Any links or pointers if known to anyone are most welcome
Thanks and Regards,
Pramod
|
|
|
|
|
|
Hi,
can you elaborate more
i did not get you
actually i have seen that the dll's code can be viewed using a reflector
and i dont want that to happen with my dlls
Thanks and Regards,
Pramod
|
|
|
|
|
Did you click on the link I posted? Obfuscation is a technique that is aimed at preventing disassembly, which is what you're looking at.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote: Obfuscation is a technique that is aimed at preventing disassembly,
It doesn't really prevent disassembly. Rather it helps preventy someone from garning anything useful from the disassembly by obfuscating the code the point that it is no longer easily readable.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
What you want is not possible. The best you can hope for is to obfuscate the code and hope that the little bastard trying to disassemble it, doesn't have the time to dig your code out of the garbage that the obfuscator creates.
Even if you managed to compile the managed code down to native code, your code can still be disassembled, though it just takes more time to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|