|
Hi all. I have three columns in Table say A , B , C. The datatype of all columns is BIT . At a time, only one value can be true. like
A B C
true false false
false true true
Now, in gridview, I want to show that if the value of column A is true, it has to show some image else no image.
Please tell me how to do that. I will be very thankful to you.
Thanks for your anticipation.
|
|
|
|
|
Hello,
I would like to ask you about tool, which can generate documentation for projects in .NET 2.0 based on XML documentation files.
I know only an unofficial version of NDoc with support for .NET 2.0.
http://jonas.lagerblad.com/blog/?p=4
Maybe you know alternative to this tool?
Thanks in advance
cyberjoe
|
|
|
|
|
Take a look at the following article here on CP: Sandcastle Help File Builder[^]
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello all
is there any method to bind the thread name property of the thread class with the id property of the processThread class.
my application create more than one thread bt i cant keep track of them as i cant map the id with the name
Please Help
MiNa
|
|
|
|
|
I had been looking for this too, and did not find anything.
Threads do have a name, but we programmers have no control over it.
The .NET doc says the name of a System.Thread can be set once, if that is also
true for the underlying Win32 thread object, then I am afraid .NET gives it the
name "Thread" and we can't do anything about it.
Luc Pattyn
|
|
|
|
|
Thanks,
I was trying to assign an id to each thread by getting the last thread id added to the processThreadCollection directly after starting the thread to ensure that this ID belong to the just started thread.
and then i can track the thread wether they are running or not and knowing the state of them,
but this solution is risky as the number assigned may be wrong.
Any other suggestions ?
MiNa
|
|
|
|
|
Some ideas:
1)
Inside your app you could attach a name to your thread by using a hash table;
that could help keeping track of things, but it only lives inside your app.
External tools for watching processes, threads and other resources (such as TaskInfo)
would not know about it of course.
2)
When your app contains logging, you could add a thread identification, based on ID
or attached name, or whatever (always starting with Thread.CurrentThread).
If your threading situation gets complex, you really should do this.
3)
whatever you come up with, some threads will not follow your scheme, e.g.
Threadpool threads, Backgroundworkers, etc.
But I avoid these, since you dont have full control over them (set priority, kill, ...).
4)
I tend to use my own thread class that holds a thread and a descriptive text, but also a
mechanism to report progress and a means to cancel/kill/abort
(I started doing this before NET 2.0, so before Backgroundworkers were available).
Luc Pattyn
|
|
|
|
|
how do i can keep track the threads using hash table ?
i want to know the state of the thread i created.
and all the info about the threads in the processThreadCollection is the ID
and actually i dont know which thread has this ID
Thanks again for your help
MiNa
|
|
|
|
|
Hi,
the following is not correct, it gives the ideas, first for .NET 1.1 then 2.0
with .NET 1.1:
when you create a thread, insert it in a hashtable
Thread thread=new Thread(...);
threadHash.Add(thread, "Searching database");
thread.Start();
you can now list all your threads:
foreach (DictionaryEntry de in treadHash) {
string descr=(string)de.Value;
Thread thread=(Thread)de.Key;
...show the thread, its ID, its state and descr
}
the only caveat is: doing this keeps all thread objects alive, since they are all in
the hashtable, so you should try to throw away the ones you dont need anymore,
either with threadHash.Remove() when a thread comes to an end,
or by periodically checking the thread states.
with .NET 2.0:
when you create a thread, insert it in a hashtable
Thread thread=new Thread(...);
threadHash.Add(thread.ManagedThreadID, "Searching database");
thread.Start();
you can now list all your threads using
foreach (Thread thread in processThreadCollection) {
string descr=threadHash[thread.ID];
...show the thread, its ID, its state and descr
}
Since you are not holding a collection of thread, there is no cleanup problem.
Luc Pattyn
|
|
|
|
|
Plz refere.........
System.Monitor class
Protecting Code by Using the Monitor Class
The System.Monitor class enables you to serialize the access to blocks of code by means of locks and signals. For example, you have a method that updates a database and that cannot be executed by two or more threads at the same time. If the work being performed by this method is especially time-consuming and you have multiple threads, any of which might call this method, you could have a serious problem on your hands. This is where the Monitor class comes in.
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Thanks
do you mean i have to lock the code that start the thread and gets the last added thread in the processThreadCollection to ensure that the number assigned to the thread is the correct number in the processThreadCollection ??
Thanks again
MiNa
|
|
|
|
|
Plz refere this code.............
using System;
using System.Threading;
class Database
{
public void SaveData(string text)
{
lock(this)
{
Console.WriteLine("Database.SaveData - Started");
Console.WriteLine("Database.SaveData - Working");
for (int i = 0; i < 100; i++)
{
Console.Write(text);
}
Console.WriteLine("\nDatabase.SaveData - Ended");
}
}
}
class ThreadLockApp
{
public static Database db = new Database();
public static void WorkerThreadMethod1()
{
Console.WriteLine("Worker thread #1 - Started");
Console.WriteLine
("Worker thread #1 - Calling Database.SaveData");
db.SaveData("x");
Console.WriteLine("Worker thread #1 - Returned from Output");
}
public static void WorkerThreadMethod2()
{
Console.WriteLine("Worker thread #2 - Started");
Console.WriteLine
("Worker thread #2 - Calling Database.SaveData");
db.SaveData("o");
Console.WriteLine("Worker thread #2 - Returned from Output");
}
public static void Main()
{
ThreadStart worker1 = new ThreadStart(WorkerThreadMethod1);
ThreadStart worker2 = new ThreadStart(WorkerThreadMethod2);
Console.WriteLine("Main - Creating worker threads");
Thread t1 = new Thread(worker1);
Thread t2 = new Thread(worker2);
t1.Start();
t2.Start();
}
}
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
i can understand your idea, but how this will help me to track the thread ?
and to know the state of t1 or t2 if it is waiting or suspended ...
Thanks again
MiNa
|
|
|
|
|
In MS Access, i can retrieve data from a table cell in a HTML page using Webbrowser like this:
txtResult = WebBrowser0.Document.all.tags("Table")(TableNum).Rows(Row).Cells(Col).innertext
But i can't find the way to do the same thing in C# Can I get some hints pls?
|
|
|
|
|
pls try this
via java script.........
var table = document.getElementById("tableId");
var row = table.rows[2];
var cell = row.cells[0];
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Ty for your reply. I can do it in Access and java also. But in C# i guess i must use the HTMLTable to get the table. But i still cant find how to use it through Webbrowser.
|
|
|
|
|
how to programming a program that store a DXF(Autocad File) in SQLSERVER And be able zoom in/out ?
|
|
|
|
|
I have this problem:
I want to open in a notepad some text from my exe application. Should be something like view source in IE.
I have a textbox where I have a lot of text. And, because it's difficult to edit text in a text box, I thought that is much easy to send that text to a notepad window. BUT... I don't want to save the text before to open it in notepad.
Any suggestion?
Thanks!
|
|
|
|
|
Wat do u mean ":it's difficult to edit" do u want to format(font/size) the text or juz copy/paste options.. if you want format then design a notepad of urself..(or search google to get the same) or use richtext box for minimal formatting.
RB contains builtin functions to format/edit
|
|
|
|
|
Could it be that you do not have the MultiLine property set to true. That could make a lot of different when editing a zillion line text file. When you have multiline set to true than you can edit the width/height of the control so more text is visible both vertically and horizontally.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
What i need is a way to paste some text from another application, to a running notepad.
|
|
|
|
|
You could try to transfer the text using the clipboard:
select and copy in your app, then send key events for CTRL/V to the window of your
target app. You would have to find the process ID, its main window, and perform
either a SendMessage, SendKey or SendInput.
There is an MSDN article explaining SendInput is "more reliable" than SendKey ?!?!
I have not done this myself (I created my own editor though).
Luc Pattyn
|
|
|
|
|
Thanks Luc,
I'll try to do what u suggested - and the idea with my editor is also good. It's not so difficult to do an simple text editor.
|
|
|
|
|
Using the clipboard like that is not good practice. What if the user has something in the clipbaord that they want to be there?
What's so bad about saving a temp txt file to open with notepad?
|
|
|
|
|
If I save the file and open it in a notepad after this, when the user do save, the file is saved in that location, and this is what i want to prevent. I want that notepad, when the user chose to save that text, to open a save dialog, and to ask the user the name/location for that file.
And about the clipboard.... the things stocked in it are temporary, and supposedly are not so important! (or can be recovered at any time)
|
|
|
|