|
I stand corrected. After a reboot, I can have 2 separate monitors at different resolutions. The Cursor.Clip is working for me because I have a dedicated application running, so the user can't interact with the rest of the system. But you are correct, once the application loses focus, the Cursor.Clip no longer works. Everything is working just the way a want it to, so thanks again.
|
|
|
|
|
Need to time stamp the last time a file was considered good.
I was trying to use something like: last_Time = DateTime.Now;. This is used inside a decision block. The problem even if the condition to enter the particular block isn't met, it still updates.
So does DateTime.Now execute no matter what?
Now for what I really need. I need to timestamp a infopacket/file/situation as to the last time it passed inspection. In other words when was the last good infopacket/file/situation.
The following code is what I thought would work:
public static DateTime last_Time;
public void Packet_Check(int decision)
{
pass_counter++;
if (decision == 1)
{
stateIndicatorComponent2.StateIndex = 4;
pass_counter = 0;
last_Time = DateTime.Now;
TRUCK_ID_DISPLAY.BackColor = Color.White;
Performance_Log_File(this.Name, Convert.ToString(last_Time)+ " last good packet " + port_in );
}
else
{
if (pass_counter > 3)
{
stateIndicatorComponent2.StateIndex = 3;
}
if (pass_counter > 7)
{
stateIndicatorComponent2.StateIndex = 2;
}
if (pass_counter > 12)
{
Diag_Box.Text = "lastime is " + last_Time;
if (light == true)
{
stateIndicatorComponent2.StateIndex = 3;
TRUCK_ID_DISPLAY.BackColor = Color.Red;
light = false;
}
else
{
stateIndicatorComponent2.StateIndex = 2;
TRUCK_ID_DISPLAY.BackColor = Color.Yellow;
light = true;
}
}
}
}
Thanks
modified on Thursday, May 21, 2009 10:12 AM
|
|
|
|
|
DateTime.Now is a static property that will always return a DateTime set to the current system's time.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks. One more bit of knowledge in the bucket.
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Something like this. Reread
|
|
|
|
|
much better. Now I'll read it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
the code shown has only one way to modify last_Time. If you are not satisfied with the value of last_Time, AFAIK there are only two possibilities:
1. Check(1) is called where Check(0) was intended, causing the block with "ast_Time=now" to execute.
2. More Check(1) calls are performed, maybe entirely unrelated to the ones you are looking at, but since last_Time is static, they all share that one variable.
Suggestions:
1. don't use static variables unless you really need them; when they just seem the easy way to solve something, they will come back at you later on. A better way would be to make them non-static and instantiate your class once for every independent series of checks you want to perform (you already have to instantiate since Check itself is not static).
2. choose better names for your variables, especially the class members (last_Time) and the method parameters (decision). Also use boolean type if only two values are allowed, use an enum when more than two non-counting values are acceptable.
Instead of if(decision==1) ... I would write if (packetOK) ... or if (packetState==PacketState.Good)...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Funny thing you should say about the static last_time. That's exactly what I did. Take off the static and it worked just as planned. Thanks for the second confirmation.
That's why I like this place
Later!!
|
|
|
|
|
Hi,
I have written a program that goes out to Fox News (http://www.foxnews.com) on an hourly basis and picks up the podcast for broadcasting on my local radio station. The software has been working perfect for the last 3 years. Now all of a sudden it will pick up and play the same .mp3 file over and over again. I suspect it is left over in the cache and that they are now tagging to cache that file. If I reboot the machine it picks up the latest podcast and works again. However every following hour it repeats the 1st newscast again and again.
I haven't done a lot of web programming and I've been looking at my C# book but I'm unsure how to ensure the cache has been cleared. How can I ensure the cache has been cleared?
Thanks,
Glenn
|
|
|
|
|
hell sir,
i am working on datagrid control in c# window application
i use datagridtextbox in datagrid . my probblem is that how can i do datagrid textbox column enable=false if it contains data =sunday
my code is...
try
{
dataGrid1.DataSource=null;
dt.Clear();
dataGrid1.TableStyles.Clear();
ad=new SqlDataAdapter("select * from attendance where months='"+txtmonth.Text+"' and class='"+txtcurrentclass.Text+"' and section='"+txtsection.Text+"' and session='"+Class1.session+"'",cn);
ad.Fill(dt);
dt.Tables[0].DefaultView.AllowNew=false;
dataGrid1.DataSource=dt.Tables[0];
DataGridTableStyle tbl=new DataGridTableStyle();
tbl.MappingName=dt.Tables[0].TableName;
DataGridTextBoxColumn txt=new DataGridTextBoxColumn();
// txt.MappingName=dt.Tables[0].Columns["id"].ColumnName;
// txt.HeaderText="SNo.";
// txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
// txt.TextBox.Enabled=false;
// txt.ReadOnly=true;
// txt.Width=45;
// txt.TextBox.BackColor=Color.Salmon;
// txt.NullText="0";
//
// tbl.GridColumnStyles.Add(txt);
//
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns["Studentcode"].ColumnName;
txt.HeaderText="Student Code";
txt.ReadOnly=true;txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.TextBox.BackColor=Color.Salmon;
txt.TextBox.Enabled=false;
txt.TextBox.WordWrap=true;
txt.Width=160;
txt.Alignment=HorizontalAlignment.Left;
tbl.GridColumnStyles.Add(txt);
//
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns["studentname"].ColumnName;
txt.HeaderText="Name";
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
txt.TextBox.Enabled=false;
txt.TextBox.BackColor=Color.Salmon;
txt.TextBox.ForeColor=Color.Blue;
txt.ReadOnly=true;
txt.Width=80;
txt.Alignment=HorizontalAlignment.Center;
tbl.GridColumnStyles.Add(txt);
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[4].ColumnName;
txt.HeaderText="1 "+txtmonth.Text;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.Alignment=HorizontalAlignment.Center;
txt.Width=65;
if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{
txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[5].ColumnName;
txt.HeaderText="2 "+txtmonth.Text;
txt.Width=47;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
txt.Alignment=HorizontalAlignment.Center;
if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{
txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[6].ColumnName;
txt.HeaderText="3 "+txtmonth.Text ;
txt.Width=47;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.Alignment=HorizontalAlignment.Center;
if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{
txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);
//class1
txt=new DataGridTextBoxColumn();
tbl.GridColumnStyles.Add(txt);
dataGrid1.TableStyles.Add(tbl);
my problem is that i want to make textbox readonly in txt.Textbox contains data=sunday and when i scroll data datagrid first three columns do not scroll except else.
please help me ..
|
|
|
|
|
Investigate the OnCellPaint event handling.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello all,
I've added this line in my VC# editor as a reference from the Outlook
Object model:
using Outlook = Microsoft.Office.Interop.Outlook;
But, I don't think this exists (or I get an error anyways).
Can anyone direct me to the correct reference?
Thanks.
|
|
|
|
|
It looks like the correct spelling.
Have you added a reference to it to your project? That's often what's missing...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
I'm pretty sure there is a reference in my editor.
I've followed this to the 'T': http://support.microsoft.com/kb/819398
|
|
|
|
|
OK - that's not the way I've added a reference for it.
Instead of going through the "COM" tab in the Add Reference dialog, try the ".NET" one, and if you scroll down you should find "Microsoft.Office.Interop.Outlook". Try using that as the reference instead.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hello,
I have a ComboBox, which get its values from BindingSource, and gets its current value from another BindingSource. (If it matters, the source of the BindingSource is DataSet).
Here is the problem i am facing: i want the combo to present the values, but with exta information that changes from value to value.
I want that for strings that are 3 length long, will be showen with extra "!!", and strings with 5 length long will be shown with exta "@@".
For example, if this is the content of my DataSet (which connected to the BindingSource): dog, cat, cool, animal
so this is how the value would seem to the user:
dog!!, cat!!, cool, animal@@
of course i dont want the DataSet behind the BindingSource to be changed.. just for the combo presentation.
Thank you very much,
Liran.
|
|
|
|
|
|
This is how i did it"
i captured the event handler for FormatChanded.
and in it, i used the FormatEventArgs to change the value in code.
for example: if (blabla) then e.value += (blabla)
no CustomFormatter needed
Thanks alot.
|
|
|
|
|
How can I make a treeview with some nodes have checkbox and some not? please help
|
|
|
|
|
Hello
Help me Please!!
the problem occur when :
first i run my chat program and it's working well , but when i get out of my program
at log back in im getting this error at the server When he try to invoke me some event:
{"Found two different objects associated with the same URI, '/999013af_72e3_42b1_affa_43766d7f541f/Chat'."}
i just dont know what to do :S
here is the client side app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="IskaMessengerCommanObject.RemotableObejct, IskaMessengerCommanObject"
url="http://XXXX:7717/Chat"
/>
</client>
<channels>
<channel
ref="http"
port="0"
>
<clientProviders>
<formatter ref="soap" />
</clientProviders>
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
and this is the instance im running from client
RemotingConfiguration.Configure("c:\\Hafaka\\IskaMessengerUser.exe.config", false);
RemotableObejct RemoteObject = (RemotableObejct)Activator.GetObject(typeof(RemotableObejct), "http://xxxxxxxxxx:7717/Chat");
<div class="ForumMod">modified on Friday, May 22, 2009 3:47 AM</div>
|
|
|
|
|
Hi all,
I keep getting the following error message:
<br />
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. <br />
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext() <br />
at System.Windows.Forms.Application.ExitInternal() <br />
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t) <br />
at System.Windows.Forms.Control.WndProcException(Exception e) <br />
at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e) <br />
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) <br />
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) <br />
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) <br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) <br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) <br />
at System.Windows.Forms.Application.Run(Form mainForm) <br />
at BlueBroadcaster_Ultimate.ProgramClass.Main(String[] args)<br />
does anybody know what this means or where it could be originating from?
BlueBroadcaster
|
|
|
|
|
Actually, it's not crazy. It's probably something like :-
foreach (Object obj in myCollection)
{
myCollection.Add(anotherobj);
}
and it's telling you that you can't add / remove / clear or whatever in the collection you're iterating over.
If you only ever want to add new items, you can use a "for (int loop=0; loop<myCollection.Count; ++loop)", although that will iterate over the new items as well.
Otherwise, create "Add" and "Remove" lists which can be processed after the main loop to add and remove as needed.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Sounds like Items was removed from your list before the line that causes error.
hope usefull.
sorry for bad english.
|
|
|
|
|
Basically, you cannot alter a collection of items as you ForEach over it. You can make changes to the items inside the collection, but you cannot add or delete items to the collection itself.
|
|
|
|