|
thnx 4 reply.my reports not contain so much code it simply bind a record with a button.
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("C:\\WebSite1\\CrystalReport2.rpt");
CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.RefreshReport();
}
|
|
|
|
|
when i use the multi-thread i have met a problem just like it:
Object obj;
Thread[] mythread = new Thread[dt.Rows.Count];
for (int i=start;i<end;i++)
{
.....................
if (isSameNet == true)
{
//Begin the thread
mythread[i] = new Thread(new ParameterizedThreadStart(gatherOnlineTimeOfSame)); }
else
{
mythread[i] = new Thread(new ParameterizedThreadStart(gatherOnlineTimeOfDiff));
}
mythread[i].Start(obj);
}
...........................
finally
{
DBer.closeConnection(conn);
}
the code is right when it excute by unuse thread.
but when it excute just as up.the programe will excute,but
the result is wrong.during the programe running it will not has
any error.when i debug it,it will stop on the code "DBer.closeConnection(conn);". By the way the function "gatherOnlineTimeOfSame" and "gatherOnlineTimeOfDiff" are both right, i have tested.
their content are about the DB's operation.
Any help will be appreciated!
|
|
|
|
|
I cant make sense of your question. Are you saying that restarting an old thread causes the issue ? Do you have locking code around all your database code ? Do you use transactions to avoid race conditions ?
I assume that start is always 0 and end is always dt.Rows.Count ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thank you Graus.My problem have been solved.
the reason is that sub thread is running too slower
but the main thread is too fast,the sub thread is deal with DB
so the sub thread is excuting but the DB Connection has been closed.
so the problem ..... Now i updated the source it works OK.
Thank you for your help.
|
|
|
|
|
scoket wrote: Now i updated the source it works OK.
"it works" is a necessary condition, not a sufficient one, for a program to be correct.
If your main thread is to close the database, it has to wait for all other threads to finish.
There are a couple of ways to do this, Thread.Join is one of them.
FWIW: Thread.Sleep is not.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
hw can i get the text of node on clicking in treeview?
|
|
|
|
|
I would expect that there's a selection changed event, a selectedItem property, and a Text property on the Node that is the selected item. Is this not so ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hey all, i have a question. I've searched everywhere for the answer and I can't find anything. So here it is. This is a part of the code, which I've copied from somewhere by the way.
<br />
public static bool IsUserPlayingFullscreen()<br />
{<br />
IntPtr hWnd = GetForegroundWindow();<br />
if (hWnd == GetDesktopWindow())<br />
{<br />
Logger.LogMessageToFile("F***");<br />
return false;<br />
}<br />
<br />
RECT rcWindow;<br />
GetWindowRect(hWnd, out rcWindow);<br />
IntPtr hm = MonitorFromRect(ref rcWindow, MONITOR_DEFAULTTONULL);<br />
if (hm == IntPtr.Zero) return false;<br />
MONITORINFO mi = new MONITORINFO();<br />
mi.cbSize = Marshal.SizeOf(typeof(MONITORINFO));<br />
GetMonitorInfo(hm, ref mi);<br />
return EqualRect(ref rcWindow, ref mi.rcMonitor);<br />
}<br />
Anyway, here I'm trying to detect if a full screen application is running. Runs pretty nice in most of the situations, besides one. If the desktop window is active, it is tricked in believing it is a FS App. I thought that this
"if (hWnd == GetDesktopWindow())" would detect if the current active window is the desktop, but it doesn't! Any help? Thanx in advance!
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:23am.
|
|
|
|
|
Thanx for the reply! Although I'm having quite some trouble converting it to C#.
This is where I've reached so far. For some reason it doesn't get by while (hWnd != IntPtr.Zero). As I've checked (hWnd == IntPtr.Zero) is always true.
<br />
public static bool IsFullScreenMode()<br />
{ <br />
int w = GetSystemMetrics(SM_CXSCREEN);<br />
int h = GetSystemMetrics(SM_CYSCREEN);<br />
<br />
IntPtr hWnd = new IntPtr();<br />
<br />
hWnd = FindWindowEx(GetDesktopWindow(), hWnd, null, null);<br />
while (hWnd != IntPtr.Zero)<br />
{<br />
if (GetWindowLong(hWnd, GWL_EXSTYLE) == WS_EX_TOPMOST)<br />
{<br />
RECT rcWindow;<br />
GetWindowRect(hWnd, out rcWindow);<br />
if ((w == (rcWindow.right - rcWindow.left)) && (h == (rcWindow.bottom - rcWindow.top)))<br />
{<br />
return true;<br />
}<br />
}<br />
hWnd = FindWindowEx(GetDesktopWindow(), hWnd, null, null);<br />
}<br />
return false;<br />
}<br />
Would be glad if you could help
|
|
|
|
|
Ok, I figured out that the desktop window is not what I see on the desktop(wallpaper).
So how do I get the wallpaper window handle?
|
|
|
|
|
IntPtr vHandle = FindWindowEx(GetDesktopWindow(), IntPtr.Zero, "Progman", null);
I found it! This is the one! This returns the handle to the Desktop ListView
|
|
|
|
|
I would want to realize a vumeter for measured the levels of the sound the one files audio....
I use Visual C# 2008.
Please, help me!!
What "class" must I use?
How must the code C# be?
I wait for your help.
Thanks
|
|
|
|
|
What have you tried ? What sort of audio format do you expect to examine ? What are you trying to achieve in general, what's the end goal ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
There is a lot of stuff on this subject available on the web, and it is not a simple problem. DirectSound seems to be the recommended way these days.
A quick Google search[^] lists hundreds of disscusions and articles on this subject
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
I am trying to graph xy position for a third variable value. Ex .. pressure distribution over an area. Does anyone know if ms chart can do this?
I have been going through the ms winsamples and documentation, did some googling but came up short.
any tips or hints for other graphing packages that could do such a thing would be helpful.
|
|
|
|
|
I was recently reading the docs, and I don't think it does that. I believe the Dundas chart does, and I'm not sure if that's free now, or not.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I called dundas, and they said they do not offer a z axis. But thanks for your time, I appreciate it.
|
|
|
|
|
Have a look at that[^]!
There is about 72 samples, that will help!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
thank you so much, I think WPF Dynamic Data will do it.
|
|
|
|
|
Our app pretty much takes over the machine it is running on (we customize machines and place our app on them).
What I need to know is if there is a way (and if so how) to launch Windows's internal dialogs for configuring the wireless adapters in a system running Windows 7. If you can tell me how to do it in Vista, that might be OK too, because they might end up being the same.
Thanks!
|
|
|
|
|
|
Yes, it does - and that is exactly what I was looking for.
Thanks...
|
|
|
|
|
Hi all,
I just need to know how do encrypt one column in my datagridview out of many.
I do not want to show that column value to user because it contain password.
thanks in advance
|
|
|
|
|
you don't want to show it encrypted, just don't show it at all, either by writing your own column definitions, or by not requesting it from the data source.
You don't encrypt passwords in your data source ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|