|
hi,
If you don't want then don't declare that public datatable variable. I told different way to achive your result. that's it.
Please re-write your AddDt and form_Load events.
private void addDT(out DataTable Dt)
{
DataTable test = new DataTable();
test.Columns.Add();
dataGrid1.DataSource=test;
Dt=test;
}
private void Form1_Load(object sender, System.EventArgs e)
{
DataTable Dt;
addDT(out Dt);
//Here you will get the DataTable Which is There in your addDT method
}
feel free to ask more questions
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi again
now how can i add new row to the DataTable from the button1_Click(.....) ???
|
|
|
|
|
sakkijha wrote:
in this code i define a public dataTable "t",
Please correct me, but I think you declare t as a private member.
sakkijha wrote:
i want to use the DataTable "test" -which is defined in the addDT() function - in the button1_Click
You're already doing this by declaring t = test; and then using t in the button1_Click method. Keep in mind that test is only a reference to the DataTable and t references the same DataTable after the assignment.
You could even spare declaring test:
private void addDT()
{
t = new DataTable();
t.Columns.Add();
dataGrid1.DataSource=t;
}
www.troschuetz.de
|
|
|
|
|
How to convert a a char[] array into a byte[] array? (without converting each char in particular)
Ariadne
|
|
|
|
|
hi,
using System;
class Example
{
public static void Main()
{
Char[] chars = new char[]{'A','B','C','D'};
byte[] br = Converter(chars);
}
unsafe static byte[] Converter(char[] Arr)
{
unsafe
{
byte[] By=new byte[Arr.Length];
fixed(char *p_arr = Arr)
{
char *p_elem = p_arr;
for(int i=0;i
|
|
|
|
|
char[] c = new char[] {'a','b','c'};
byte[] b = System.Text.Encoding.Default.GetBytes(c);
|
|
|
|
|
Hi All,
I am using timer in one of the application I am developing.
When I try to set the interval to "2233860000.0 millisec", I am getting the following exception
"Number must be either non-negative or -1.\r\nParameter name: dueTime"
Here is the code snippet I am using
System.Timers.Timer timerTest = new System.Timers.Timer();
timerTest.Interval = 2200920000.0;
timerTest.Enabled = true;
timerTest.Start();
timerTest.Elapsed +=new System.Timers.ElapsedEventHandler(time_Elapsed);
Thanks in Advance,
Jo
|
|
|
|
|
|
timer.Interval is double not 32 bit integer
|
|
|
|
|
You are wrong. It is Int32.
|
|
|
|
|
Actually, it is documented to be a Double . Check it out here[^] and here[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oh, I have to admit I didnt read carefully enough. I thought he meant System.Windows.Forms.Timer.
I couldnt reproduce the problem. The code works fine in my sample project.
|
|
|
|
|
It should work, but I don't have VS.NET in front of me to play around with it.
Also, the other comments about having this fire 25 days later are correct. It's just not practical to assume that your code is going to be running constantly for a month straight. What are you doing with this code? There are FAR more accurate and easily implemented methods to getting a time based event running on such a long period schedule.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using this in a windows service. If the users dosen't shutdown the system for a longer period. I required my timer to schedule to a desired time.
|
|
|
|
|
In that case, use the timer, set at one minute, to kick off a procedure that will compare the current system time to the scheduled time of your task. If they match up, kick off your process, else do nothing. That way, if the machine gets restarted, you won't have to reset the timer to a calculated interval WAY off in the future.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is what I thought as solution. But just curious to know about the problem.
Thanks,
Jo.
|
|
|
|
|
I want to build a classic 3-tier application. I want the business logic layer to be fully independent of UI(i.e. it should work well for both windows and web applications well and good). How can i pass the data between the tiers. What are the options available. what about raw xml, dataset, serialized xml or serialized dataset.I would also like to know why I should use one technique over the other.
Any help appreciated.
Thanks in advance.
anand
|
|
|
|
|
The way you move the data is irrelevant. I'd move data in whatever form is easiest, i.e. when connecting to a database, I'd just return a dataset, unless only one value is called for.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
hi,
Lot of ways are there to move data to and fro to any layer. If it is a database related operation then we can persist the data in dataset or datatable. If it is some other requirement then you can go and change the accesability modifiers of feild or data members.
My favorate way is, Encapsulate all logic into a .dll file and communicating through messaging.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Make the three tiers like the
a. The UI tier (ASP.NET Web based or C#.NET Windows based)
b. The business logic (C#.NET Web Service)
c. Storage tier (Database and file system)
Between a and b the data will flow with the SOAP protocol in form of XML. This will allow third party clients like external systems, Unix based programs to connect with your software.
Between b and c you need not worry about how data flows, let the ADO.NET classes take care of that.
a never talks with c directly.
Hope this helps. For more info read Web Services turorials, WS client tutorials and an ADO.NET book.
|
|
|
|
|
hi ,
Coulld you tell me where exactly CTS and CLS come into picture in the execution of .NET Application , at the time of source code to MSIL ? (or) MSIL to machine code ? please clarify my doubt .
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
is there a way i can write a program to run other programs as administrator while loged on as a limited users
thanks
chad
|
|
|
|
|
hi,
Windows services will help you out do this.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
can you give me a code sample to show me how to use windows services to run another program as the administrator
chad
|
|
|
|
|
Windows 2000 and above already does this. Search your Help for RunAs.
Basically, you need two applications. One is running as a service and will accept a command line that you want it to run and a username and password to tell it who to login as. The other is the interface that will get this information from the user and send it to the service for execution.
But, like I said, this already exists in Windows 2000 and above. All you need to do is make sure that the service is running using the Services control panel.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|