|
Why are you only drawing when FirstRun is true? Why not just draw every time your form is painted?
The on paint method gets called when the form needs to be redrawn, like when you minimize, something covers your form up, etc.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hello all,
In my webservice, in a webmethod named emData, I am extracting some data from a sql server database and arranging those data in a DataSet following some query. Now that DataSet is the return value of my webmethod emData. I am working with C#
How can I show that dataset in my client winform in a normal table after receiving it from the webservice?
Please help me to solve this out.
with regards,
Faysal
|
|
|
|
|
The dataset returns a set of tables (or maybe just one in your case). Just bind that table to say, a datagrid. That'll display the data and you can work your way through other bindings afterwards.
emData.Tables -> specify the table name (string) or index (int) starting with 0.
|
|
|
|
|
may i know how to clear this error ? i tried use this System.Configuration.ConfigurationManager.AppSettings' but i canot find the .configurationManager..
private string sqlString = System.Configuration.ConfigurationSettings.AppSettings["connectionString"].ToString();
Warning 2 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
|
|
|
|
|
Make sure you include a reference to the System.Configuration assembly in your project references.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Looks like you are trying to add this line in the class level where variables are declared.
Try using it insie the function / main where you require it.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
I think you wanted this reply to go to the original poster...
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Yup..Sorry it is my mistake. You have already replayed it with the code block so it should help the poster now
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
after included i cant find the COnfigurationManager also ...
system.configuration. only have
.ConfigurationSettings and
.ConfigurationException
|
|
|
|
|
Did you also add a "using System.Configurtion" to the file?
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
yes.. i had added.. the using System.Configuration but still don have the manager thing.
|
|
|
|
|
What does your code look like? Here is a simple example:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string test = ConfigurationManager.AppSettings["test"];
}
}
}
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
i declare under this.. as global.. i do not want each function declare that..
namespace ttt
{
public class Dataaccess
{
private string sqlString = System.Configuration.ConfigurationSettings.AppSettings["connectionString"].ToString();
private SqlConnection cn;
|
|
|
|
|
First, please use the "code block" tags (<pre>) with code blocks like that to preserve the formatting.
Second, see my other resposne. You want your code to look something like this:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
namespace DataAccessLayer
{
public class DataAccess
{
private string connectionString;
public DataAccess()
{
this.connectionString = ConfigurationManager.AppSettings["connectionString"];
}
public string ConnectionString
{
get
{
return this.connectionString;
}
}
}
}
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
thanks for the wonderful reply...
BUT .. i just cant get the $#&(#$ manager
Error 3 The name 'ConfigurationManager' does not exist in the current context
i had put the below script in the constructor as what u told..also added the using System.Configuration;
this.connectionString = ConfigurationManager.AppSettings["connectionString"];
but just no manager come out..
|
|
|
|
|
It still sounds like you haven't included the reference in the project. This is different than the "using" statement. In Visual Studio, expand the "References" folder of your project and make sure that you see "System.Configuration" listed. That should be all you need to do.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
i ask from u, say me a website, content this web is some exercice program with explain solution type code. i am biginer programmer i want i progress in c# but i don't know how and which topic program , i write or i want write program but i don't know i write which topic program, i like help me i write bigginer program and ... ... .... ... ... after i write advance program. do u understand, my english very bad. i don't say u , write me web.
pliz help me, i need.
tnx
modified on Sunday, May 25, 2008 9:17 AM
|
|
|
|
|
I have no idea what you're really asking. But I would suggest:
1. Buy a book in your native language
2. Use google search for articles/content in your language so you can learn
|
|
|
|
|
Hello everyone,
I have the following scenario, and my question is whether I need to add lock or not?
In my scenario, there are two threads, one thread is accessing Dictionary instance Dic1, and the other thread is creating new Dictionary instance regularly in some interval, and the new Dictionary instance is named Dic2, and this thread will assign the instance pointed by Dic1 to Dic2, so that the new produced Dic2 could be processed by the first thread.
(Dic1 is like data consumer, and Dic2 is like data producer.)
1.
My question is whether I need lock for the operation for Dic1 of thread1, and Dic2 to Dic1 assignment operation in thread 2?
2.
Beyond using lock, are there any more efficient method? e.g. less locking? or not using lock at all?
Some pesudo code,
lock (Dic1)
{
Dic1.op1();
Dic1.op2();
Dic1.op3();
}
Dictionary Dic2 = new Dictionary();
Dic2.insert();
Dic2.insert();
Dic2.insert();
lock (Dic1)
{
Dic1 = Dic2;
}
thanks in advance,
George
|
|
|
|
|
I would use lock, if not you may be perfoming some operation with the data in Dic1 when you change it, who knows what could happen.
I think lock is fairly efficient though. Unless your operations take 5 minutes, and the second thread has to wait for the first to release the Dictionary.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks SK,
Generally, I agree with you. But what do you mean "your operations"? Could you clarify which operation in which thread do you mean please?
regards,
George
|
|
|
|
|
I meant where you did:
Dic1.op1();
Dic1.op2();
Dic1.op3();
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks for your clarification, SK!
regards,
George
|
|
|
|
|
Hi George,
I would do that without any lock, but with careful programming:
1.
the dictionary producer (Thread2) does not need a lock, since Dic1=Dic2; is an
atomic operation. The statement either has been entirily executed, or it has not at all;
there is no way to have half of a reference replaced.
2.
The consumer wants a consistent dictionary, so make a local copy and use that throughout,
as in:
{
Dictionary localDic=Dic1;
localDic.op1();
localDic.op2();
localDic.op3();
}
|
|
|
|
|
So great, Luc!
1.
I have re-written the code as you suggested, here is my code, could you help to review whether it is your idea please?
{
Dictionary localDic=Dic1;
localDic.op1();
localDic.op2();
localDic.op3();
}
{
Dictionary Dic2 = new Dictionary();
Dic2.insert();
Dic2.insert();
Dic2.insert();
Dic1 = Dic2;
}
2.
Luc Pattyn wrote: Dic1=Dic2; is an
atomic operation.
Do you mean all reference assignment operation is atomic in C#? Any support documents?
regards,
George
|
|
|
|