|
I want to give a background image that is very necessary but in vb application it is working very fast but in c# it takes too much time.
I'm using core 2Dou 2.0 GHz.
Syed Shahid Hussain
|
|
|
|
|
Then that has to be (pretty much) down to differences in your code, doesn't it? Since VB and C# both use the same .NET framework and runtime, there has to be a significant difference between the two programs.
What are you doing in the C# that you aren't in the VB?
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
sorry I was talking about VB6. It its loading speed is too fast.
And I want to develop an on screen key board. Do u also have any idea about that? Thanks
Syed Shahid Hussain
|
|
|
|
|
CodeProject holds a couple of articles on virtual keyboards. I suggest you search and read them.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
VB6 I can't help with - I bailed out of VB around Version 2 - but I assume VB6 is native code rather than .NET? If so, then I would expect it to load a lot faster, as there is no large framework to worry about. C# need the framework, so will load slower.
Having said that, just how many controls do you have? And what size/format is the image?
It may be worth just loading the app without the image and seeing if that speeds up the load enough. If it doesn't then I suspect you may have to go the "put-up-a-splash-screen-so-no-one-notices-it-is-so-slow" route that Adobe tried...
See Lucs' answer re the virtual keyboard.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Thanks a lot Friend
Syed Shahid Hussain
|
|
|
|
|
Pleased I have small problem about controls and class.
I have my new Winform class with a single label in my project and I want to write information in this label in another non GUI class I don't know how I can proceed
Exemple:
public partial class Form1:Form
{
privata Server serv = new Server(); //Form1 has-a Server
....
}
This is my non UI class
public class Server
{
public Server(){}
}
|
|
|
|
|
This is considered rude here.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
Ok imagine you create a new Winform whit a single label.
And you add a new class named Server for example.
You want to write a simple hello word in the label but this time via your new class which reside in a single file.
|
|
|
|
|
which part of "Don't repost the same question" don't you understand? you will be blacklisted!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Pleased I have small problem about controls and class.
I have my new Winform class with a single label in my project and I want to write information in this label in another non GUI class I don't know how I can proceed
Exemple:
public partial class Form1:Form
{
privata Server serv = new Server(); //Form1 has-a Server
....
}
This is my non UI class
public class Server
{
public Server(){}
}
|
|
|
|
|
Hi,
best is to use a delegate for this, and provide an event.
this[^] explains it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
This is basic object oriented programming!
Expose a property or method in the Server class that allows you set the value from the label.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Don't repost the same question Remove the second one before someone answers and you can't remove it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi all
I have a big issue with threading in Windows Forms.
For example:
I have a .NET 2.0 (VS 2008) Windows Forms Solution
with one form in it (as default Form1).
I make this Form1 as MdiContainer.
In the Load Event I create a new thread and after this I
load a new Windows Form as Mdi Child.
In the thread I just read about 1mio rows in a DataTable
using standard DataReader.
Now because I have created a new thread, I would expect
the load time of this large amount of data would not affect
the loaded form, but it does ...
After starting the application, I grab the child form and I
just move it arround the Container form and it allways
hangs for some time ...
When I reduce the amount of data to just some rows,
the form feels free.
Here I send you my code and I would be very very happy
for a solution of this problem !
Thanks and best regards
Frank Uray
private static bool StopThread = false;
private void Form1_Load(object sender, EventArgs e)
{
System.Threading.Thread local_Thread = new System.Threading.Thread(RunThread);
local_Thread.Start();
System.Windows.Forms.Form local_Form = new System.Windows.Forms.Form();
local_Form.MdiParent = this;
local_Form.Show();
}
private void RunThread()
{
System.Data.SqlClient.SqlConnection local_SqlConnection = new System.Data.SqlClient.SqlConnection();
System.Data.SqlClient.SqlCommand local_SqlCommand = new System.Data.SqlClient.SqlCommand();
System.Data.SqlClient.SqlDataReader local_SqlDataReader;
local_SqlConnection.ConnectionString = @"Data Source=MyServer\MyInstance;Initial Catalog=master;Integrated Security=true;";
local_SqlConnection.Open();
while (!StopThread)
{
local_SqlCommand.CommandText = "SELECT * FROM SomeTable";
local_SqlCommand.CommandTimeout = 0;
local_SqlCommand.Connection = local_SqlConnection;
local_SqlDataReader = local_SqlCommand.ExecuteReader();
System.Data.DataTable local_DataTable = new System.Data.DataTable();
local_DataTable.BeginLoadData();
local_DataTable.Load(local_SqlDataReader);
local_DataTable.EndLoadData();
System.Threading.Thread.Sleep(2000);
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ StopThread = true; }
modified on Wednesday, February 3, 2010 9:14 AM
|
|
|
|
|
Please show formatted code, use PRE tags! You can still edit your message.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi Luc
What are PRE Tags ??
When you paste the code into Visual Studio
it is formatted automaticly.
Regards
Frank Uray
|
|
|
|
|
PRE tags are HTML instructions that provide background color, non-proportional font, syntax coloring (on CodeProject at least), and indentation, like so:
public class CPTest_OwnIPAdr : CPTest {
public override void Test(int arg) {
String strHostName;
strHostName = Dns.GetHostName();
log("Local Machine's Host Name: " + strHostName);
IPHostEntry ipEntry = Dns.GetHostByName(strHostName);
IPAddress[] addr = ipEntry.AddressList;
for (int i = 0; i < addr.Length; i++) {
log("IP Address "+addr[i].ToString());
}
}
}
I don't copy/paste all messages to Visual, I do read a lot of messages provided their formatting is acceptable, so please add <PRE> and </PRE> around code snippets. The "code block" widget may help you.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi Luc
Ok, I have changed it
Regards
Frank Uray
|
|
|
|
|
Some things are missing or unclear here:
what is the purpose of local_DataTable? where is the data ever used?
why would you load the same data all the time (at 2 sec intervals)?
and where is it related to your Form(s)?
BTW: if you set Thread.IsBackground true, that thread will stop automatically when the main form gets closed, so it no longer prevents process termination.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi Luc
The local_DataTable and the 2 sec interval
are just for testing purpose.
In the real application I display some information
from the database and in some interval I refresh
this informations.
Because the database is quite large these querys
take some time and I have seen the application
stuck allways when these querys are executed.
I dont understand why this happens, I was thinking
a thread should not affect the form as longest
there are no invoke or begininvoke.
I have also already tried to create a simple
exe with just this RunThread void in it and
I have loaded it with "AppDomain.ExecuteAssembly"
but this has the same effect to my main Mdi Container form ...
In my mind, this is strange ... )
Thanks for your help !
Best regards
Frank Uray
|
|
|
|
|
you'd get better help by showing actual code and explaining the phenomena about it, not by mocking it up. Chances are you have illegal cross-thread issues. Until you show real code, this[^] probably is all I can help you with.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Well, the point is, in this little sample application
I do not have any cross-thread issues and it does
not work how it should or how expected.
When I post my productive code, it just makes
it more complex to find a solution,
thats why I reduced just to the problem.
But thanks anyway.
Regards
Frank Uray
|
|
|
|
|
I haven't run your code (I'm not going to), however AFAIK the only way it could slow down your GUI is when you have a single core and the database access takes more than 2 seconds, hence cluttering up everything else.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hi Luc
I have just found out this:
When I add the following code (in RunThread), nothing is blocked
while (true)
{ string local_Test = System.DateTime.Now.ToString(); }
Of corse, Processor usage is growing but the application
is free, nothing is blocking ...
I think now my problem has something to do with the
Datatable or with the SqlConnection ...
Regards
Frank Uray
|
|
|
|