In effect yes, each truck is to be timesliced, a chance to send and recieve data by itself. The maincontroller, parent form, contains the comport feature. The parent form also creates an instance of each truck when its time for that particular truck. I hope that clarifies. I have a zip file of a more defined situ. Unfortunatley I haven't found a place to apply an attachment. Thanks for reply L.
Lecutus1
Posts
-
What is happening is info from one child form is being received or listen to by the wrong child form. -
What is happening is info from one child form is being received or listen to by the wrong child form.Thanks Alan As to the first question, I'm not recieving bad data, I've got a filter for that, I'm recieving data from another truck. Your absolutely right as far as write and wait for a response before moving to the next truck. I'm still trying to get used to the timing of this RS232 and its behaviour. Once again this was a case of overcooking the goose, in other words I did too much, too quickly when a a little less could have been used. Thanks once again
-
An odd predicament with windows formsnik121 wrote:
Hello I'm new to C# so you might have to bear with me a little bit but here is my problem. I am trying to make a windows form so that when you press a button, all the buttons disappear from the form. When that happens I am trying to make a different button take its place. You might find this a strange thing to do... but I have my reasons ;P. This is as far as I have gotten.
Another way to go is add all the buttons your going to use the first time around. Then decide which are to be visible and which are not. If you're putting to a form, all the buttons will have they're properties shown in the properties tab. There you can get the individual poperties, including visiblity. I've got my properties in alphabetical order, just to find them, I hate searching. Then just program behavoir of the buttons Have a good time L.
-
What is happening is info from one child form is being received or listen to by the wrong child form.What is happening is info from one child form is being received or listen to by the wrong child form. The situ is one parent form and any number of child forms. Specifically this is a truck control system, all the the truck/child forms are the same. But the monitoring and controls for each are to be independent of the other's actions. Example one truck could be in neutral with a rpm speed of 800, while another truck is in 3rd gear with rpm of 1000. So the situation has to be contained within the logical confines of the individual childform/truck. I've tried using access modifiers to there extent. Making things 'private' as much as possible, getting rid of as much 'static' as possible. What is first sent is the info packet. Defined as: !!!780;125;1400;0;5000&&& The truck sends back a string of data for processing, and as confirmation of what's wanted by the operator. The string looks like this: I5000R0780G02O099C060V23.3W2440F099L4S01400P00000X126Y057B27.08H65253E01T01D0000_99! Within the program I'm using a ID_Parser to strip/read out the identifier at the beginning of the string to make sure it gets sent to the right form. Actually creating a instance of the truck/chilform that the info belongs to. I had to do this because sometimes the sending form would receive info string from another truck. This routine does put the port_in into the proper truck and its accompanying array: public static string[] Trux_Info = new string[20]; The letters designate different pieces of information 'I ' designates id of the truck in this case truck5000, the 'R' is rpm, 780, followed by gear and so on. The transmission is by RS-232, on the parent form, constantly open. Each truck sends/ reads through this, and the buffers, in and output, is flushed after each use. I've tried individual comports per childform, but had unaccessible issues. As I have ran out of ideas and test methods I asking if anyone sees what I'm missing. Further definitions, test methods, and results are provided as an attachment. Is there way to attach attachments, I have them already zipped.? Thanks
-
I'm needing to have a textbox to be on top of all other controls on the form.I'm needing to have a textbox to be on top of all other controls on the form. What would be the proper technique. This particular textbox is for emergency messages, so has to be attention getting. I can get it to resize, enable, and disappear. But can't get it to be seen over the form controls I've been having problems messagebox in a loop. I'm using VS2005, C#. Thanks
-
This is a performance issue: Struct vs. Class.Sorry for wasting everbody's time. I'll do more research before asking anything. I thank everybody for there response. L.
-
This is a performance issue: Struct vs. Class.This is a performance issue: Struct vs. Class. I'm at that point in development where I need to make the app more stable. The program is a truck control and monitor system. Right now the app can have any number of trucks, let's say 5. Each has an engine, the shape of the information will be given later. The child form per truck has controls to change RPM, GEAR, and Pressure as well as gauges to monitor various other aspects of information being sent back to the form from the actual engine. Needless to say this makes for all trucks to be observable a little hard on one screen. This is where the truck monitor comes in, a smaller version with bear minimum, to have all trucks on screen. I've designed where each truck gets a time slice since we're using RS-232. We're locked into this there is no negotiating this point. Each truck writes to, receives from the engine, process information, writes to file, and eventually send to monitor child form. All this occurs at 250 ms per truck. Each truck has a monitor for mostly display and contains three controls. As to the processing, each truck listen to incoming port, for properly formed string data, parses the data, assigns proper portion to the right variable of the engine and gauges. Such as, rpm info is place in engine.rpm_var and so on. All this is accomplished through a loop on the parent form, MainController. This parent form has the comport portion,RS-232, here. The loop looks this:
Indiv_Truck_Cntrl tempChild = (Indiv_Truck_Cntrl)this.MdiChildren[trxx];
{
Truck_Active.Text = tempChild.Name;
//Performance_Log_File("from " + tempChild.Name, " tempChild.port_out = " + tempChild.port_out);
Main_Serial_Port1.Write(tempChild.port_out);test\_port = Main\_Serial\_Port1.ReadExisting(); //Performance\_Log\_File(tempChild.Name, " has in test\_port = " + test\_port); if (test\_port == "") { // commment } else { Send\_Truck\_Info(test\_port); } tempChild.SEND\_SETTINGS\_Click(); // goes to Indiv\_Truck rat here!!!!!
So the question here is do I use a class or a struct for the information I need, that is for Engine. Right now I have my Engine defined as:
public class Engine
{
private string c_TRUCK_ID; -
Need to time stamp the last time a file was considered good. [modified]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. ;P That's why I like this place Later!!
-
Need to time stamp the last time a file was considered good. [modified]Thanks. One more bit of knowledge in the bucket.
-
Need to time stamp the last time a file was considered good. [modified]Something like this. Reread
-
Need to time stamp the last time a file was considered good. [modified]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)
{ /* checks for last good info packet. checks from lightest to most sever.
* if decision = 0, add 1 to pass_counter
* if decision = 1, pass_counter = 0, good packet and timestamps
*/
/*
int pass_marker = 0;// make global
int pass_counter = 0;// make global
int first_check = 0; // make global bool used if first pass made
*/
pass_counter++;
if (decision == 1)
{
stateIndicatorComponent2.StateIndex = 4;
pass_counter = 0;
last_Time = DateTime.Now; // <<<<<<<< EXECUTES EVERY PASS, aargh!!!!!!!!!
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) //change to yellow
{
stateIndicatorComponent2.StateIndex = 3;
//pass_counter++;
}if (pass\_counter > 7) // red { stateIndicatorComponent2.StateIndex = 2; //red //pass\_counter++; //Diag\_Box.Text = " Last Entry -- " + last\_Time + "\\r\\n " + File\_Write\_Hold; } if (pass\_counter > 12) // red with warning message { //mess sent to operator Diag\_Box.Text = "lastime is " + last\_Time; //Diag\_Box.Text = pass\_counter + " " +this.Name + " has failed to recv good info/packetsince " + last\_Time + " check all input!!!!"; if (light == true) { stateIndicatorComponent2.StateIndex = 3;
-
How does one have mdichildren forms automatically sized to fit the parent form?Thanks, I'm developing in VS2005 and it doesn't have that setting in the property view. But that gives me an idea of what to look for and I'll still take any other answer Thanks
-
How does one have mdichildren forms automatically sized to fit the parent form?How does one have mdichildren forms automatically sized to fit the parent form? My situation is I may have 5 to 10 child form at once and I would like to see all at once. I'm developing in C# in Visual Studio 2005 Any and all suggestion are appreciated. Thanks
-
Moving an array element to a variable.Ok It's one of those things where another of section of code was causing the problem. It had nothing to do with the array. Problem fixed array transfered properly. Say it with me now, ROOKIE!!!!!!!!!!!!!! I do appreciate the expediant answers. Consider this line/thread closed Thanks L.
-
Moving an array element to a variable.Moving an array element to a variable. When I started I didn't think just taking an element and copying to a variable was such a hassle. OK, I have a string array defined as: public static string[] Trux_Info = new string[20]; and I have a varaible define as public static string port_in = ""; Now I thought that something like port_in = Trux_Info[3] would work. It didn't. I tried Trux_Info.GetValue(3). It didn't work right. I know Trux_Info has info I can print to screen\file and the right info is there. I even passed the array across child, parent and back to a different child, the info is there. I really need this element to go to this single variable, because after this happens then the processing can begin. Any and all suggestion are appreciated. Thanks
-
How does one regenerate a form?How does one regenerate a form? I had a form up and running, did a save and then nothing. The form reapeared with no controls on it. I checked the Code view and all the code was there. I checked the form.designer.cs, all the descriptors for all the boxes, control, and everything else were there. So why isn't being seen. This is the second this has happened. I dont want to recreate the whole project. How can I "turn on" or recreate this form? I'm using VS2005 Standard Thanks
-
Can you declare an array of mixed Types?Can you declare an array of mixed Types? I need have an array that contains: int key, form Control, form Monitor Form [50,3] Truck Is it possible? Thankx
-
How to declare/tie a mdigrandchild form to mdiGrandParent form?I would but what is the method if I can't use: The parent is MainIndiv_Truck_ControlMDI : Form the child1 is declared inside the parent as: child1 = Indiv_Truck_Control TruckForm = new Indiv_Truck_Control(); TruckForm.MdiParent = this; Then child1 spawns a child of its own, grandchild. The grandchild has to be inside the MainIndiv_Truck_ControlMDI : Form. grandchild.Mdiparent = "what"? I'm not sure how to say the "what"? part. Thanks
-
How to declare/tie a mdigrandchild form to mdiGrandParent form?How to declare/tie a mdigrandchild form to mdiGrandParent form? Situ: I'm writing some code/mdiParent that spawns a child form, child1, that has all the information capturing. Now child1 spawns a child, grandchild. The grandchild is a lean version of child1, readonly type situation. Child1 is not shown, but working. Grandchild is to: Grandchild.show(). Needed: I need to declare the grandchild to show in the mdiParent. I'm sure it's somthing similar to : The parent is MainIndiv_Truck_ControlMDI : Form the child1 is declared in the parent as: Indiv_Truck_Control TruckForm = new Indiv_Truck_Control(); TruckForm.MdiParent = this. I know I'm missing something. I can make the grandchildren, but there happening outside the MdiParent. I want them to happen inside MainIndiv_Truck_ControlMDI : Form Thanks in advance.L.