|
its means that there is no functionality like msde toolkit in vs 2005 which we can easily use in vs 2000
|
|
|
|
|
is there any way to use msde deployment toolkit 2000 with vs 2005
|
|
|
|
|
I've always written a core installer exe which runs the msi's for other products I need, in C++.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
In my table one column datatype is timestamp in sqlserver database.While getting data into dataset that value is visble as 0X000000000000007D1. But how i know wats that value is?. I want to create a csv file with that data, which i got from dataset. Please help me out.
Thanks in advance everybody.
|
|
|
|
|
What code are you using to end up with this value ? I always read dates from the DB as dates, I've never had this issue.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
timestamp is a binary - try this[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi everyone,
i have a code like this:
if (condition == true)
{
Thread t = new Thread(new ParameterizedThreadStart(Func));
t.Start(param);
}
.
.
.
Func(Object o)
{
Form1 form = new Form1(o);
form.Visible = true;
}
but when the thread starts, my form appears and suddenly it disappears . it seems thread ends the form process. what should i do?
thanks in advanced
|
|
|
|
|
Your problem is that the Form1 instance goes out of scope. When this happens, it gets Dispose()'d. When it gets disposed, it closes. You have two options
- Instead of setting form.Visible to true, call ShowDialog(). This will halt Thread execution until the Form closes
- Put the Form variable at the class level. This will tackle the basic problem
Just as an aside, you should be using safe cross-thread access by now if you aren't already. It looks longer, but is far better than just setting AllowCrossThreadCalls to true
|
|
|
|
|
wow! it really worked. i can't believe it! wonderful
you know? working with threads is really confusing
thanks again
|
|
|
|
|
If you need any additional information, then Luc Pattyn's post below is a good read. When you aren't accessing any Controls, it's very similar to normal, single-threaded programming. The only exception is synchronisation - if you're modifying a variable in multiple Threads, then make sure it's synchronised otherwise you might end up with a race condition
|
|
|
|
|
Hi,
you get one of my standard replies:
Controls are not thread-safe, hence they should be touched (that is: their methods or properties called) only by the thread that created them, which normally is the main thread (aka GUI thread). Creating some controls on a different thread is unlikely to be successful, since all Controls get linked somehow: they reside on Forms, Forms are related to each other (by Parent, by Z-Order, etc), so normally all are created on a single thread.
If you violate the “don’t touch Controls from another thread” rule and are running .NET version 2.0 or above you will get an InvalidOperationException (“Cross-thread operation not valid”), which should be remedied by changing the code.
Do not set Control.CheckForIllegalCrossThreadCalls false, since that does hide the exception but does not cure the fundamental flaw in your code, so it just postpones the moment of failure, which typically will show as a non-responsive and possibly badly painted GUI.
Here are some ways to get another thread:
- explicitly launching a Thread instance
- exclicitly delegating some work to a ThreadPool thread
- using a BackgroundWorker; a BGW is a separate thread with the advantage that two of its events (ProgressChanged and RunWorkerCompleted) execute on the GUI thread; however the bulk of the work normally is handled in the DoWork handler which runs on a distinct thread.
- using timers other than System.Windows.Forms.Timer; the Forms timer ticks on the GUI thread, all other use different threads to handle the periodic event;
- using asynchronous input/output, such as the DataReceived event of the SerialPort class
Any of these touching a single method or property of a Control is sufficient to create havoc; there are 5 exceptions:
- the InvokeRequired property
- the Invoke, BeginInvoke, EndInvoke and CreateGraphics methods (the latter only if the handle for the control has already been created).
If there is a need to touch the Control from another thread, one must use an Invoke pattern, which in C# basically looks like this (VB.NET would be very similar):
public void SetText(string text) {
if (myControl.InvokeRequired) {
myControl.Invoke(new Action< string >(SetText),
new object[] {text});
} else {
myControl.Text=text;
}
}
|
|
|
|
|
I have seen you post this 'standard reply' atleast 4 times a week.
|
|
|
|
|
That doesn't make it any less useful. I've got it bookmarked, and it answers common questions well
|
|
|
|
|
There are people who read (almost) everything on one or several forums, and it is to warn them for a repeat answer that I start with a sentence about "standard reply".
And there are people who don't read anything at all, all they do is post a question when they have one; for the most "popular" problems, I have standard replies and I just copy/paste them from my repository to the message editor window, that is more efficient that retyping similar answers all the time.
BTW: the standard replies evolve over time; when they are incorrect, incomplete, or misunderstood, I tend to improve them. And no, they don't come with a version number. yet.
|
|
|
|
|
lol... the 'standard reply' is a good one... and like you said not every1 reads them. You should plan on versioning your 'standard replys'. It will help the few people who actually read it.
|
|
|
|
|
Hello,
I'm trying to access an element from the following function, can you help me ?
I've tried a lot of constructions without success.
Edit:
I`m using VS2008\.NET 3.5
The function below should access the "i" value for single types and arrays at the same time, for single types it`s ok, but for arrays I don`t know how to access array elements. I can check i.GetType().IsArray, but don`t know how to access particular elements.
static void function<t>(ref T i)
{
string s;
if ( !i.GetType().IsArray )
s = i.ToString(); // ok
else
// next line doesn't compile: Cannot apply indexing with [] to an expression of type 'T'
int a = i[0];
}
Caller code example:
int a = 5;
function(ref a);
int[] arri = { 3, 5, 7 };
function(ref arri);
Thanks for any help.
|
|
|
|
|
static void function(ref T[] i)
Your code declares i as a T. In order to access it as an array, you need to specify it as one (unless you like pointer arithmetic and a whole world of pain). But your function code is concerning. The idea of generics is to make something type-safe. What happens if T is a String? A nasty error. Incidentally, you should have gotten another error at the invocation point (something like "Cannot implicitly convert between int[] and int")
|
|
|
|
|
You have to declare the argument as an array if it is one. Like so:
static void function(ref T[] i)
But your next line:
int a = i[0];
won't compile anyway, since the compiler cannot garantuee that T is of a type that is convertible to an int .
Use something like this instead:
static void function(ref T[] i) where T : struct
{
try
{
int a = Convert.ToInt(i[0]);
}
catch((FormatException)
{
}
...
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Thanks Thomas, I edit the question and explained it better. My problem is basically to access the "i" value when the function receive single types and arrays too, my problem is to get the value of each element when the type is an array (which I can check using i.GetType().IsArray).
Thanks anyway.
|
|
|
|
|
Then there's a small problem with my code. Try this:
public static IEnumerable<t> GetIEnumerable<t>(T input)
{
if(input is IEnumerable<t>)
{
foreach(T element in (input as IEnumerable<t>))
yield return element;
}
else
yield return input;
}</t></t></t></t>
As a bonus, this also deals with all IEnumerables (ArrayLists, List<t>s, etc), not just arrays. You could replace IEnumerable<t> with T[] and get your original query.
|
|
|
|
|
It doesn't work: Unable to cast object of type 'System.Int32' to type 'System.Int32[]'.
|
|
|
|
|
In this case you can simply declare two overloads, one for normal elements and one for arrays:
static void function(ref T i)
{
DoSomething(i);
}
static void function(ref T[] i)
{
foreach(T element in i)
{
DoSomething(element);
}
}
static void DoSomething(ref T i)
{
...
}
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Thomas Weller wrote:
catch(FormatException)
FTFY (extra bracket)
|
|
|
|
|
I was wondering if somehow it is possible to make objects readonly if referenced by another assembly but writeable when accessed internally?
For example I have a scenario where I need to pass objects to UI. UI must not be allowed to temper with the object in any form or fashion but the business layer should have full access to the object as we need to do some computation after the object is inialized by the DAL.
I was just wondering if there is a preferred way of dealing with situations like these that I am not aware of?
Would appreciate the help ...
Thanks in advance.
|
|
|
|
|
Like so?
private int p;
public int Property
{
internal set { p = value; }
get { return p; }
}
warning: untested
|
|
|
|