|
Stefan R wrote: I'm pretty fluent in VB syntax so i don't mind
Yeah, I changed the code becauseif you're caught posting VB code in the C# Forum, ... well, let's just say it makes the movie "Desparado" look like a Sunday Brunch.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
if i create a webbrowser object, and there is a form (with name="something") on the page displayed, is there a way i can automatically submit it using c#?
thanks in advance,
sam kline
<a href="http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450">YES</a>
|
|
|
|
|
Hi, Does anyone know a good way to make reports in c#? not in Crystal Reports(Money issue) ..
i'm lookin for a simple report, maybe something thats like access reports.. ..
any idea will do ..
thanks in advance ,.. Yosi.
|
|
|
|
|
There is at least one free library that draws graphs, you could use that to create your own report, I guess. You'd have the data you need from your data source already.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I recently made reports using the GDI, PrintDocument and PrintPreview controls of .NET. Although its a lot of boring work when you use GDI to draw lines and such but I did it.
Bikash Rai
|
|
|
|
|
Is there anychance you can post me the code?
i'm in a mess... i got this presentation on sunday, and i was counting on that crystal reports, but then i found out it need to be registerd...
anyhow,, if you could post me the code , i will the most grateful man on eatrh!
|
|
|
|
|
I have sent you the code as a Zip attachment. Although the code is in VB.NET I think you won;t have any problems porting it to C#. I couldn't post the code here because the code's long...... really long.....
Happy Printing...
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
http://www.codeproject.com/csharp/letaonarticle2.asp
|
|
|
|
|
The code are looks like this:
Panel panel1 = new Panel();
if(panel1.CanFocus){
panel1.Focus();
}
Then it generated a exception at the run-time.
An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: Collection was modified; enumeration operation may not execute.
Focus() has nothing to do with the collection, is that because of UIPermission fails?
Thanks
|
|
|
|
|
Perhaps a handle of panel1 fires a method that generates that exception or that prepare the field for the exception.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
You're getting this error because a Panel control cannot receive the input focus. See Control.Focus()[^] for a list of controls that cannot be .Focus ed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks a lot. I will try to not use focus() in my code.
In fact, my problem is as this:
if(A.Focused){
B.Focus();
A.Focus(); //get an exception in main()
}
The reason for reset A's focus is that I want to clear A's keyboard input buffer. Otherwise the A's keyboard input will always be put into the next selected item.
I guess it is a bug in .net library and it can not be fixed without the source code.
Thanks again.
Merry Christmas to everybody
|
|
|
|
|
This won't clear the keyboard buffer. Once the keystrokes are sent the that window, that's it. That window has to process them.
BTW: This is NOT a bug in the .NET Framework. This is the documented behavior of the control! The bug is in the design of your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, someone knows what kind of component/widget/technique is needed to emulate the MSN (7.5) Options window behavior?
I mean, when you click any option in the listBox on the left, the groupBox of the right changes accordingly (with different set of options for each selected item).
I want to do a Configuration dialog like that and it seems not so obvious for me to figure out the best or smart way to do that.
Thanks in advance
Zopiro
|
|
|
|
|
How to break long line of code into several lines of short codes like what one can do in C++?
Thanks!
Devin
|
|
|
|
|
int my_very_long_variable_name = My_Very_Long_Method_Name(my_first_argument, my_second_argument, my_third_and_longest_argument, "some very long long string....");
Can be writen as well as
int my_very_long_variable_name = My_Very_Long_Method_Name(
my_first_argument,
my_second_argument,
my_third_and_longest_argument,
"some very long"+
" long string...."
);
btw, if you have a very long math expession, uualy is more useful to write it step by step (aoiding bugs is a must)
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
|
<br />
int i;<br />
Form2 f2=new Form2();<br />
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
f2.Show();<br />
f2.textBox1.Text=i.ToString();<br />
loop();<br />
}<br />
private void loop()<br />
{<br />
for(i=1; i<1000000;i++)<br />
{<br />
f2.textBox1.Text=i.ToString();<br />
f2.Refresh();<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
With above code, I want to let i show in the testbox1 of form2 while the interation in funcion loop in going on. When I run the program. at first it works, but after i get to around 10000, the form2 freezs,and it will not update the value of i. If I click the form. The form2 's text will show some thing like ( not responding).
How can I fix this problem?
Thank.
|
|
|
|
|
Threads would solve your problems. Create the second form on a separate thread (and paint it - set the text property to aother controls) and all things should run smoothly.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Thank you for your response.
I have never program in thread. can you please give me an example or a source online where i can find an example?
Thanks
|
|
|
|
|
Search on CodeProject an example of SplashScreen (they are kind o the same, use threads in order to display dinmicaly changing data)
Implementing with threads your solution may not be the best method, but from what I can imagine this may work fine. If you want me to help you more specify in what circumstances you show the second form, and how long (until a button is pressed, or until a time is elapsed)
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Here's some code. No comments, though. I'm sick today and don't feel that loquacious. Hope it helps.
using System;
using System.Threading;
using System.Windows.Forms;
namespace Project1
{
public class MainForm : Form
{
private OtherForm otherForm;
public MainForm()
{
otherForm = new OtherForm();
Button b = new Button();
b.Text = "Click Me";
b.Click += new EventHandler( RunAThread );
Controls.Add( b );
}
private void RunAThread( object sender, EventArgs ea )
{
otherForm.Show();
ThreadWorker tw = new ThreadWorker( otherForm.tb, new OtherForm.UpdateText( otherForm.UpdateTextBoxText ) );
Thread t = new Thread( new ThreadStart( tw.RunAlotOfIterations ) );
t.IsBackground = true;
t.Start();
}
[STAThread]
public static void Main( string[] args )
{
Application.Run( new MainForm() );
}
}
public class OtherForm : Form
{
public TextBox tb;
public OtherForm()
{
tb = new TextBox();
tb.Dock = DockStyle.Fill;
Controls.Add( tb );
}
public delegate void UpdateText( string text );
public void UpdateTextBoxText( string text )
{
Controls[ 0 ].Text = text;
}
}
public class ThreadWorker
{
private Control c;
private OtherForm.UpdateText ut;
public ThreadWorker( Control target, OtherForm.UpdateText del )
{
c = target;
ut = del;
}
public void RunAlotOfIterations()
{
for( int i = 1; i < 1000000; i++ )
{
c.Invoke( ut, new object[] { i.ToString() } );
}
}
}
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
In this case, launching another thread is overkill. All you need to do is let your app process the WM_PAINT messages it's getting when you call .Refresh()
private void loop()
{
for(i=1; i<1000000;i++)
{
f2.textBox1.Text=i.ToString();
f2.Refresh();
Application.DoEvents();
}
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a data grid that is displaying data from a MSAccess Database. Using a oleDbAdapter. Everything works well with the datagrid, add/update/insert/delete, are all good when I type directly into a cell. Howevere, when I choose a value from a combo box, outside the datagrid, and press a button that changes a selected cell in the datagrid, the update to the database does not occur. I know it has something to do with typing directly into the cell versus just setting the cell equal to a value.
//This line of code successfully puts the data in the grid
dataGrid1[gRowSelected,4] = cmbGenre.Text;
//But the update of the DB does not happen, A restart of the app shows the previous data
oleDbDataAdapter1.Update(myDataSet);
myDataSet.AcceptChanges();
dataGrid1.Update();
does anyone know how I can get the data I put into the grid to get into the Database? Do I need to refresh that dataset from the datagrid? Is that possible? Any clues????
Thanks
AuZi2005
|
|
|
|
|
I think that you should get the row you are trying to modify and do your stuff there (if you want the row selected in the grid use the grid's BindingManager, or if you know some field from the row use the DataTable's Select method, ...)
Hope this helps.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|