15,892,517 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Jagadisha_Ingenious (Top 88 by date)
Jagadisha_Ingenious
9-Aug-18 5:21am
View
Thanks for your suggestion ES, that worked for me. Could you please tell me how to dispose the client object in SendCmd button click event. I tried using Client.Dispose() method, the object is not getting empty.
Jagadisha_Ingenious
29-Mar-17 0:44am
View
The following query which i tried:
SELECT tl.TESTID INTO testID FROM TESTLIB tl
WHERE tl.DBDESCRIPTION = LDescription;
SELECT tlv.testrevid INTO testRevID FROM TESTLIBREVISION tlv
where tlv.revision = 2 and tlv.testid = testID;
It throws error. Is it because i am taking testID from 1st query & using it in the 2nd query...?
Jagadisha_Ingenious
24-Jun-16 5:15am
View
Thanks Animesh Datta, but whhen i click on the row header to sort the sorting happens for that particular column & data in other column disappears. Why such a thing happens..?
Jagadisha_Ingenious
24-Jun-16 5:14am
View
Ya it will sort but data in other columns disappear why...?
Jagadisha_Ingenious
11-Apr-16 3:26am
View
Hi Hiren Soni, these two columns are null.
Jagadisha_Ingenious
11-Sep-14 8:05am
View
@Wes Aday: I am not making any conversion to the table but still i get this error. I have identity column in the table, if remove it by commenting the line of code it works fine.
Jagadisha_Ingenious
27-Jul-14 1:44am
View
@Sergey Alexandrovich Kryukov: I have used system timer to achieve even flashing of the backcolour of the button. I have an array of buttons in the UI which should work accordingly to data i get from the serial port class. By using thread how to can i achieve this changing of back color of button in certain intervals, like i have used the timer interval also to set the flashing rate of the button back color.
Jagadisha_Ingenious
26-Jul-14 2:15am
View
@Sergey Alexandrovich Kryukov: I have a windows form & in which i have a serial port class which is running on a different thread. Through this class i am fetching data & based on the data i m receiving certain actions are performed in UI to alert the user. So flashing of button backcolor is one of the method i have used, so for flashing i have another thread & this inturn invokes a timer (from toolbox) for consistent flashing of the button. Which i am not able to achieve due to some reason which i am not able to trace it.
Jagadisha_Ingenious
14-Jul-14 2:46am
View
@S.K.Tripathi: What is 101 in your SQL query?
Jagadisha_Ingenious
23-Apr-14 2:58am
View
@BELGIUMSKY: I have entered only numbers in the text format in the WindowsNo column, as shown in the table. I have not added any characters in that column so can you plz tell how to do it in such case.....?
Jagadisha_Ingenious
16-Apr-14 1:17am
View
@Emre Ataseven: As per your instructions i did move the file to MyDocuments folder & checked it works out. So how do i place this database file in target machine's MyDocuments folder while creating the exe file.
Jagadisha_Ingenious
12-Apr-14 7:58am
View
@Wes Aday: I have not disable or made read only. As u can see i have mentioned that it works through menustrip newfile click event & not through toolstrip newfile button.
Jagadisha_Ingenious
11-Apr-14 5:24am
View
Thank you sudeepvajrala... It worked out for me, i used your 1st solution for the same.
Jagadisha_Ingenious
7-Dec-13 1:56am
View
@Sergey Alexandrovich Kryukov: I have also used status bar in mdi parent & displaying childform in maximized state due to which the controls that are placed @ the bottom of childform go hidden/invisible. So what would be the best solution for this sir...?
Jagadisha_Ingenious
7-Oct-13 3:27am
View
@ArunRajendra : I have added the code, do let me know the correction.
Jagadisha_Ingenious
7-Oct-13 2:31am
View
@ArunRajendra: As per the solution i will be able to rotate the image not the control, but i need to rotate the control itself. In windows form we cannot add image directly to the form(background image can be changed) but i have a image of 25pix which is added using either picturebox or a imagelist. Also if we try to rotate the image in the picture box it rotates & background we find original image without orientation. Any solution for this....?
Jagadisha_Ingenious
19-Sep-13 2:39am
View
@Sergey Alexandrovich Kryukov: Sir if not MDI, then any other alternatives for it...? Since i have multiple forms in my project...
Jagadisha_Ingenious
19-Sep-13 2:33am
View
@Sergey Alexandrovich Kryukov: Sir, I dont know how to create UI in one file. What is the use of it & how is it helpful in this case...?
Jagadisha_Ingenious
19-Sep-13 2:31am
View
@Sergey Alexandrovich Kryukov: Sir i am not minimizing & restoring the form every 500ms i just did it once & found this type of flicker occurring while the communication is in process & if communication is stopped the flickering stops too.
Jagadisha_Ingenious
18-Sep-13 2:50am
View
@Sergey Alexandrovich Kryukov: Sir i forgot to mention that the flickering occurs when i minimize & restore the MDI Parentform containg the childform in it, & not when i minimize & restore the childform.
Jagadisha_Ingenious
18-Sep-13 2:05am
View
Deleted
@Sergy Alexandrovich Kryukov: I have a mdi form in which i have opened 1 of the childform, containing rectangle shape, serial port communication & many other controls in it. What i do is, i will select the comport & press start button to start communicating through serial port. Once the communication starts the received data is processed & UI is updated accordingly. What i feel is while updating the UI the rectangle shape is being infected. The following is my code.
To fix the rectangle shape @ the centre of the screen i have used the following code:
private void DisplayWindow_MaximumSizeChanged(object sender, EventArgs e)
{
rectangleShape1.Left = (Screen.PrimaryScreen.Bounds.Width / 2)-183;
rectangleShape2.Left = (Screen.PrimaryScreen.Bounds.Width / 2) - 153;
}
private void rectangleShape1_ParentChanged(object sender, EventArgs e)
{
rectangleShape1.Anchor = AnchorStyles.Top;
rectangleShape2.Anchor = AnchorStyles.Top;
}
Serial Port Comm part:
private void comstartbtn_Click(object sender, EventArgs e)
{
sp.PortName = cmpprtcmbbox.SelectedItem.ToString();
sp.Parity = Parity.None;
sp.StopBits = StopBits.One;
sp.BaudRate = 9600;
sp.DataBits = 8;
timer = new System.Threading.Timer(new TimerCallback(Receive_Data), null, 0, 500);
try
{
if (sp.IsOpen == false)
{
sp.Open();
comstartbtn.Enabled = false;
cmpprtcmbbox.Enabled = false;
comstpbtn.Enabled = true;
((MainWindow)this.MdiParent).toolStripStatusLabel1.Text = "STATUS : " + sp.PortName+ " Opened successfully";
}
}
catch (Exception ex)
{
}
}
private void Receive_Data(object obj)
{
try
{
int btr = sp.BytesToRead;
data_9 = new byte[btr];
sp.Read(data_9, 0, btr);
for (int i = 0; i < btr; i++)
{
if (data_9[i] == 36 && start_collction == 0)
{
start_collction = 1;
}
if (start_collction == 1)
{
serialData.Append(data_9[i].ToString() + ",");
if (serialData.ToString().Contains("65"))
{
start_collction = 0;
q = serialData.ToString().Split(',');
List<string> list = new List<string>(q);
list.Remove("65");
list.Remove("");
if (q[1] == "1")
{
UV1ledbulb.Blink(0);
}
}
}
This UV1ledbulb lies on the rectangle shape.
Jagadisha_Ingenious
23-Aug-13 3:07am
View
@z3ngew: Hi i tried but it doesn't work. I have a MDI form in which one of the child form consists of rectangle shape. This rectangle shape changes its location when i minimize & restore the MDI Parent form & not when i do the same with the child form. So how do i avoid this...?
Jagadisha_Ingenious
12-Aug-13 6:55am
View
@Syed Shabeer: Thanks for your valuable suggestion the issue got resolved, the flickering stopped but it takes time to load, so how to increase the speed of it..?
Jagadisha_Ingenious
11-Aug-13 0:47am
View
@Virusstorm: Yup thats exactly what i am doing... Then when i click load button & select the saved file i need to show the values that was saved in those ComboBoxes.
Jagadisha_Ingenious
9-Aug-13 2:52am
View
@virusstorm: Thanks for the suggestion u have given. But the actual stuff is i have many comboboxes to which the data is added manually. While loading the form these values are loaded with the selected index to show @ startup. I have 2 buttons save parameters & another load parameters, so during save i am fetching the selecteditem from all the comboboxes, creating a xml file and saving it in a local directory. When i click on load parameters i need to fetch & display the parameters that was saved earlier. So in this case how to do it...?
Jagadisha_Ingenious
6-Aug-13 2:59am
View
@OriginalGriff: Access/Jet/Ace are good options, i want to know how much amount of data can they store in them..? What would be the limitations involved in it..? Will it slow down the process(read/write) if there are more number of data in any of the above mentioned databases.
Jagadisha_Ingenious
17-Jun-13 3:57am
View
@Sergey Alexandrovich Kryukov: When i had asked this question none answered it, so when i found a solution i added it.
Jagadisha_Ingenious
11-Jun-13 5:04am
View
@john-pH: Hi john thanks for replying & i have implemented the query you have posted & it works fine, but what if the device1 shows up only 3 or more faults. As per your query i will get only the top 5 data's from the database. If it has more or less than 5 how to get all those log details. Since this logging is dynamic.
Thanks in advance.
Jagadisha_Ingenious
4-Jun-13 1:59am
View
@Jameel Moideen: Its a 50-50 case where comments say some are happy with SQL & others with MS Access so it doesn't make any difference. What i need is just pick the date & time of the day along with few string & save it in a database faster. I am able to write it to the database but it usually takes 1s-1.5s on an avg time to save it to the database.
Jagadisha_Ingenious
3-Jun-13 4:38am
View
@Sergey Alexandrovich Kryukov: Sir thank u for the support you gave to me i was able to resolve the issue. I removed all the timers & used only threads along with few changes in the code i was able to get the expected result. Once again thanks a lot for your support.
Jagadisha_Ingenious
1-Jun-13 7:50am
View
@Sergey Alexandrovich Kryukov: Sir running thread continuously isn't helping out. That flashing of button event is taking more time.
Jagadisha_Ingenious
1-Jun-13 2:32am
View
@Sergey Alexandrovich Kryukov: Sir i want this polling process to happen continuously i.e, 24hrs a day & 365 days a year. So if i don't use timer, how to run the thread continuously. Its a monitoring system app that i have developed.
Jagadisha_Ingenious
1-Jun-13 1:47am
View
@Sergey Alexandrovich Kryukov: Sir I wanted to do polling @ different intervals so i used a timer, is it a bad thing to do...?
Jagadisha_Ingenious
1-Jun-13 1:07am
View
@Sergey Alexandrovich Kryukov: Sir so i have updated the question as u said.
Jagadisha_Ingenious
31-May-13 5:21am
View
Deleted
@Sergey Alexandrovich Kryukov :
private void LogMessage(string slaves)
{
if (!string.IsNullOrEmpty(slaves))
{
List<string> slaveList = slaves.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (string slave in slaveList)
{
if (!string.IsNullOrEmpty(slave))
{
string str = "insert into ErrorLog values('" + btn[add].Text + "','" + slave + "','" + DateTime.Now.ToShortDateString() + "','" + DateTime.Now.ToShortTimeString() + "')";
DataBaseHandling(str);
}
}
}
}
This is the remaining part of the program. The problem that i face is that i am looking for 1s from the slaves & save the data in database, array & flash button based on the 1s index. This process takes more time. So do help me out & thanks in advance.
Jagadisha_Ingenious
31-May-13 5:17am
View
Deleted
@Sergey Alexandrovich Kryukov: Sir this is the remaining part of the code continued from the previous comment.
else
{
if (!bgWorker.IsBusy)
{
MyThread.Start();
}
}
}
else if (slaveData.Any(s => s == 2))
{
testaccept = 0;
errorIndexTwo[add] = SID;
for (int i = 0; i < pollLength; i++)
{
if (slaveData[i] == 2) errorList.Add(i);
}
if (Enumerable.SequenceEqual(errorList, match))
{
}
else
{
this.Invoke(new EventHandler(AcceptChangeBtnColor));
}
}
}
#endregion
int counter = 0;
private void MyCallbackFunction()
{
counter++;
Dataloggingfunction();
for (int n = 0; n < btn.Length; n++)
{
if (btn[n].Tag.ToString() == Convert.ToString(errorIndexOne[n]))
{
if (counter % 2 == 0)
{
btn[n].BackColor = Color.Red;
}
else
{
btn[n].BackColor = Color.LimeGreen;
}
}
}
}
private void Dataloggingfunction()
{
if (faultsRecorded.Count != errorList.Count)
{
DataTable source = ReturnDataTable("select RowColumns from AnnunciatorsDescription where AnnunName='" + btn[add].Text + "'");
if (source.Rows.Count > 0)
{
string descriptionName = source.Rows[0]["RowColumns"].ToString();
string[] splitRows = descriptionName.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
string[] splitColumns = splitRows[0].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
windowdescription = new string[splitRows.Length * splitColumns.Length];
int count = 0;
for (int i = 0; i < splitRows.Length; i++)
{
string[] splitColumns1 = splitRows[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
for (int index = 0; index < splitColumns.Length; index++)
{
windowdescription[count] = splitColumns1[index];
count++;
}
}
}
StringBuilder sb = new StringBuilder();
var diff = errorList.Except<int>(faultsRecorded).ToList<int>();
for (int n = 0; n < diff.Count(); n++) //diff.Count()
{
sb.AppendLine(windowdescription[diff[n]].ToString()).Append(",");
}
faultsRecorded.AddRange(diff);
bgWorker.RunWorkerAsync(sb.ToString());
}
}
void Bgupdater_DoWork(object sender, DoWorkEventArgs e)
{
var message = e.Argument as string;
LogMessage(message);
}
private void LogMessage(string slaves)
{
if (!string.IsNullOrEmpty(slaves))
{
List
Jagadisha_Ingenious
31-May-13 5:10am
View
Deleted
@Sergey Alexandrovich Kryukov: Fine here is my code:
#region Timer Elapsed Event Handler
private void DoSomething(object obj)
{
if (slaves == btn.Length)
{
slaves = 0;
Array.Clear(errorIndexOne, 0, errorIndexOne.Length);
Array.Clear(errorIndexTwo, 0, errorIndexTwo.Length);
Array.Clear(errorIndexZero, 0, errorIndexZero.Length);
}
//it executes every 800ms second
PollFunction();
}
#endregion
#region Start and Stop Procedures
private void StartPoll()
{
pollCount = 0;
slaves = 0;
if (mb.Open(cboPort.SelectedItem.ToString(), Convert.ToInt32(cboBaud.SelectedItem.ToString()),
8, Parity.None, StopBits.One))
{
btnOk.Enabled = false;
btnCancel.Enabled = true;
//Set polling flag:
isPolling = true;
timer = new System.Threading.Timer(new TimerCallback(DoSomething), null, 0, 800);
}
}
private void StopPoll()
{
if (isPolling) // check if polling was enabled
{
isPolling = false;
mb.Close();
timer.Change(Timeout.Infinite, Timeout.Infinite); //disable
btnOk.Enabled = true;
btnCancel.Enabled = false;
for (int n = 0; n < btn.Length; n++)
{
btn[n].BackColor = Color.LimeGreen;
}
}
}
#endregion
#region Poll Function
public bool testflag = false;
private void PollFunction()
{
//Update GUI:
DoGUIClear();
pollCount++;
ushort pollStart;
ushort pollLength;
pollStart = 0;
try
{
SID = Convert.ToByte(slaveaddress[slaves]);
add = slaves;
}
catch (Exception ex)
{
slaves = 0;
}
pollLength = Convert.ToUInt16(polllength[slaves]);
short[] slaveData = new short[pollLength];
//Read registers and display data in desired format:
try
{
while (!mb.SendFc3(SID, pollStart, pollLength, ref slaveData)) ;
}
catch (Exception err)
{
DoGUIStatus("Error in modbus read: " + err.Message);
}
slaves++;
if (slaveData.All(s => s == 0))
{
errorIndexZero[add] = SID;
this.Invoke(new EventHandler(ResetChangeBtnColor));
}
else if (slaveData.Any(s => s == 1))
{
errorList.Clear();
Thread MyThread = new Thread(new ThreadStart(MyCallbackFunction));
errorIndexOne[add] = SID;
errorindexaccept[add] = SID;
testaccept = 1;
testflag = true;
for (int i = 0; i < pollLength; i++)
{
if (slaveData[i] == 1) errorList.Add(i);
}
if (Enumerable.SequenceEqual(errorList, match))
{
}
Jagadisha_Ingenious
31-May-13 2:28am
View
@Sergey Alexandrovich Kryukov: Sir, i am doing polling using a different thread other than UI thread, bt still it doesn't make much difference how do i improve its performance. Is there any other solution for this...?
Jagadisha_Ingenious
30-May-13 0:23am
View
Deleted
@Sergey Alexandrovich Kryukov: Sir if polling is a bad technique, then which other method is suitable for getting the status of each device. yes i am using a single thread for doing the polling process. If timers are bad then how do i make button change its back color in every 250ms or 500ms.
Jagadisha_Ingenious
30-May-13 0:20am
View
@Sergey Alexandrovich Kryukov: Sir if polling is not the good idea to know the status of each device then which other method is suitable to achieve this..? Yes i am doing polling process in a single thread. If timers are bad then how do i change the back color of the button @ different intervals like change back color of button every 250ms or 500ms how to achieve this...?
Jagadisha_Ingenious
21-May-13 2:46am
View
@OriginalGriff: Thanks sir its working that way.
Jagadisha_Ingenious
20-May-13 7:51am
View
@R.B. Sorry it is also SID in the third if condition too. And i don't want that way if i initialize the counter instead of forloop & do it also the same problem persists so how to eliminate it..?
Jagadisha_Ingenious
20-May-13 7:31am
View
@CHill60: I want to add values to the fieldindex1[] with their respective data & start the timer only once if any of the if conditions are satisfied. If incase more than 1 if conditions are satisfied i should save for ex: fieldindex1[0] = 1; & fieldindex1[1] = 2, if 1st & 2nd if conditions are true. I don't want to use for loop here instead a better way to implement this would be good, since in the same iteration if 2 of the if conditions are satisfied i cannot save both values in the array as it will be over written, where i will loose the previous value.
Jagadisha_Ingenious
15-May-13 10:56am
View
@toAtwork: Thank you for that sir..
Jagadisha_Ingenious
15-May-13 10:53am
View
@toATwork: Thanks sir it worked with that instruction. But i want to know why such things happen...? What exactly is the cause for this..?
Jagadisha_Ingenious
15-May-13 10:45am
View
@toATwork: Yes it remains Limegreen all the time. When debugging it enters the 1st instruction but it doesn't change. How to refresh the control...?
Jagadisha_Ingenious
11-May-13 3:40am
View
@Mehdi Gholam & @Mohammed Hameed: Like if you consider faulty status of a device in a array of devices connected in a network, i should findout from which device it was, from which network it was, what exactly was the fault..
Jagadisha_Ingenious
10-May-13 6:24am
View
It contains the value same as "i" in slaveaddress array..
Jagadisha_Ingenious
10-May-13 5:02am
View
@tumbledDown2earth:
The Form1 button click event is shown below:
private void glassButton1_Click(object sender, EventArgs e)
{
string projectName = comboBox1.Text;
string projectName1 = comboBox2.Text;
string projectName2 = comboBox3.Text;
Form1 Form1 = new Form1(projectName, projectName1, projectName2);
Form1.MdiParent = MdiParent;
Form1.WindowState = FormWindowState.Maximized;
Form1.Show();
this.Close();
}
Form2 load event code is shown below:
private void Form2_Load(object sender, EventArgs e)
{
if (ESP == "2")
{
slaves = 96;
button3.Hide();
button4.Hide();
for (int i = 0; i <= 96; i++)
{
slaveaddress[i] = i;
}
}
if (ESP == "3")
{
slaves = 144;
button4.Hide();
for (int i = 0; i <= 144; i++)
{
slaveaddress[i] = i;
}
}
System.Drawing.Drawing2D.GraphicsPath g_path = new System.Drawing.Drawing2D.GraphicsPath();
Point[] myarr = { new Point(10, 35), new Point(10, 95), new Point(30, 115), new Point(120, 115), new Point(140, 95), new Point(140, 35), new Point(120, 15), new Point(30, 15) };
g_path.AddPolygon(myarr);
button1.BackColor = System.Drawing.Color.LimeGreen;
button1.Region = new Region(g_path);
button2.BackColor = System.Drawing.Color.LimeGreen;
button2.Region = new Region(g_path);
button3.BackColor = System.Drawing.Color.LimeGreen;
button3.Region = new Region(g_path);
button4.BackColor = System.Drawing.Color.LimeGreen;
button4.Region = new Region(g_path);
lineShape2.Hide();
lineShape4.Hide();
lineShape5.Hide();
lineShape11.Hide();
BSView1.Rows.Clear();
BSView1.Columns.Clear();
BSView2.Rows.Clear();
BSView2.Columns.Clear();
BSView1.ColumnCount = 1;
BSView1.Columns[0].Name = "FIELDS";
BSView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
BSView1.Columns[0].Width = 100;
this.BSView1.Columns["FIELDS"].ReadOnly = true;
BSView2.ColumnCount = 1;
BSView2.Columns[0].Name = "FIELDS";
BSView2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
BSView2.Columns[0].Width = 100;
this.BSView2.Columns["FIELDS"].ReadOnly = true;
int height = 0;
for (int row = 0; row <= (field) - 1; row++)
{
// We need to save each row as an array
string[] currentColumn = new string[2];
BSView1.Rows.Add(currentColumn);
BSView1.Rows[row].DefaultCellStyle.BackColor = Color.LimeGreen;
BSView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
BSView1.Rows[row].Cells[0].Value = "FIELD" + "-" + (row + 1);
height += BSView1.Rows[row].Height;
// BSView1.Rows[row].Cells[1].Value = "Field"+(row+1+(field/2));
BSView1.ClearSelection();
BSView2.Rows.Add(currentColumn);
BSView2.Rows[row].DefaultCellStyle.BackColor = Color.LimeGreen;
BSView2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
BSView2.Rows[row].Cells[0].Value = "FIELD" + "-" + (row + 1);
//BSView2.Rows[row].Cells[1].Value = "Field"+(row+1+(field/2));
BSView2.ClearSelection();
}
height += BSView1.
Jagadisha_Ingenious
10-May-13 4:59am
View
@CHill60 I have few code lines in form load event too.... One of them is to change the shape of the button, other for default settings of the datagridview. This error occurs during switching from form1 to form2 exactly @ form2.show(); line of the code.
Jagadisha_Ingenious
9-May-13 6:43am
View
Thanks for your valuable suggestion @Original griff i added the code in form_load event & its working fine..
Jagadisha_Ingenious
26-Apr-13 5:28am
View
Hi @OriginalGriff: i get this type of error in the line8 of the code you have posted i am using visual studio 2010 with .net framework 4.0v. So can you tell me how to overcome this error.
"The type arguments for method 'System.Linq.Enumerable.SequenceEqual<tsource>(System.Collections.Generic.IEnumerable<tsource>, System.Collections.Generic.IEnumerable<tsource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly."
Jagadisha_Ingenious
26-Apr-13 4:53am
View
Hi PIEBALDconsult, actually what i require is i am saving the data in an array & the array is updated everytime & this updated data if it contains the same value in the same position i should not perform any task. If not equal perform some task.
Jagadisha_Ingenious
5-Apr-13 1:59am
View
I am trying to open & close the serial port continuously for checking the consistency of the port. During this time it stops & sometimes when serial port is opened & if i try to stop it the PC hangs up..
Jagadisha_Ingenious
4-Apr-13 5:32am
View
I have added the code... So can u help me nw..?
Jagadisha_Ingenious
4-Apr-13 1:27am
View
Deleted
Hi here is my code..
private void btnOk_Click(object sender, EventArgs e)
{
if (!sp.IsOpen)
{
//Assign desired settings to the serial port:
sp.PortName = portName;
sp.BaudRate = baudRate;
sp.DataBits = databits;
sp.Parity = parity;
sp.StopBits = stopBits;
//These timeouts are default and cannot be editted through the class at this point:
sp.ReadTimeout = 500;
sp.WriteTimeout = 500;
try
{
sp.Open();
btnOk.Enabled = false;
btnCancel.Enabled = true;
}
catch (Exception err)
{
Status = "Error opening " + portName + ": " + err.Message;
return false;
}
Status = portName + " opened successfully";
return true;
}
else
{
Status = portName + " already opened";
return false;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
if (sp.IsOpen)
{
try
{
sp.Close();
btnOk.Enabled = true;
btnCancel.Enabled = false;
}
catch (Exception err)
{
Status = "Error closing " + sp.PortName + ": " + err.Message;
return false;
}
Status = sp.PortName + " closed successfully";
return true;
}
else
{
Status = sp.PortName + " is not open";
return false;
}
}
Jagadisha_Ingenious
2-Apr-13 1:59am
View
Hi SA, i have tried what u had suggested but still the process is too slow. How to optimize it & increase the speed..?
Jagadisha_Ingenious
29-Mar-13 5:54am
View
Deleted
Guess you didnt get my question here is the code that i have implemented.
private void GenerateTable(int columnCount, int rowCount,string allignment)
{
int count=0;
int width = 0;
int height = 0;
int btncount = 1;
//Clear out the existing controls, we are generating a new table layout
tableLayoutPanel1.Controls.Clear();
//Clear out the existing row and column styles
tableLayoutPanel1.ColumnStyles.Clear();
tableLayoutPanel1.RowStyles.Clear();
//Now we will generate the table, setting up the row and column counts first
tableLayoutPanel1.ColumnCount = columnCount;
tableLayoutPanel1.RowCount = rowCount;
#region AllignMentofButtonIntableLayoutPanel
for (int x = 0; x < columnCount; x++)
{
if (x == 0)
{
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
}
width += 120;
////First add a column
for (int y = 0; y < rowCount; y++)
{
//Next, add a row. Only do this when once, when creating the first column
if (x == 0)
{
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
}
pnelLayout[count] = new Panel();
btn[count] = new Button();
btn[count].Height = 60;
btn[count].Width = 120;
btn[count].Text = data[count];
btn[count].Name = count.ToString();
btn[count].Height = 60;
btn[count].Width = 120;
pnelLayout[count].Width = 120;
pnelLayout[count].Height = 60;
//Get the btnName from Configuration windows and check the btnName with Description
if (dtButtonName.Rows.Count > 0)
{
//Check for the same btn text Name,if it is true change the colour
for (int i = 0; i < dtButtonName.Rows.Count; i++)
{
//Check for btnName and btnCount Index
if (data[count] == dtButtonName.Rows[i]["BtnName"].ToString() && (btncount - 1).ToString() == dtButtonName.Rows[i]["BtnIndex"].ToString())
btn[count].BackColor = Color.WhiteSmoke;
else if (btn[count].BackColor == Color.WhiteSmoke)
{
}
else
btn[count].BackColor = Color.LightGreen;
}
}
else
{
btn[count].BackColor = Color.LightGreen;
}
btn[count].TextAlign = ContentAlignment.MiddleCenter;
btn[count].FlatStyle = FlatStyle.Popup;
btn[count].MouseDown += new MouseEventHandler(Annaunciator_Window_MouseDown);
btn[count].ContextMenuStrip = contextMenuStrip1;
pnelLayout[count].Controls.Add(lblCorner[count]);
pnelLayout[count].Controls.Add(btn[count]);
Jagadisha_Ingenious
29-Mar-13 0:49am
View
Sir, I have actually hid the toolstrip menuitem so any other way to achieve this...?
Jagadisha_Ingenious
28-Mar-13 9:00am
View
Dear Sir, I have implemented your code it works fine. Basically i have an array of buttons in a panel in which i wanted this enable/disable option to be included. As per the code u have given i am able to deactivate the button individually & enable it by clicking on any other button. The problem is if i deactivate all the buttons i am left with no choice to activate it. I cannot activate anyone. So how to achieve this..?
Jagadisha_Ingenious
28-Mar-13 6:40am
View
Ya fine thats correct but i need the button state to be pressed with 1 click & normal with another.
Jagadisha_Ingenious
28-Mar-13 6:39am
View
I am working on windows form platform.
Jagadisha_Ingenious
28-Mar-13 6:38am
View
Similar to toggling stuff in a single button. Windows form platform is what i am working on...
Jagadisha_Ingenious
27-Mar-13 4:06am
View
Yes sir i do agree..
Jagadisha_Ingenious
27-Mar-13 3:48am
View
Yes sir i have received your mail n thanks for that. I was able to resolve the issue to some extent i guess. Like if i switch from 1 form to another 100 times i get only 5-6 times error mentioned earlier. I had to change few instructions in my code after which it is working fine.
Jagadisha_Ingenious
26-Mar-13 1:27am
View
Sir your answer refers to polling of database & handling it, but i am not polling a database in the app that i have developed, i am just recording the instance when i get an error while polling for data through serial port.
Jagadisha_Ingenious
25-Mar-13 2:53am
View
Sir so whats your suggestion on that issue..?
Jagadisha_Ingenious
25-Mar-13 1:21am
View
Fine sir i will be waiting for it..
Jagadisha_Ingenious
25-Mar-13 1:18am
View
Sure & thanks u sir..
Jagadisha_Ingenious
25-Mar-13 1:13am
View
private void timer2_Tick(object sender, EventArgs e)
{
for (int n = 0; n < btn.Length; n++)
{
if (errorIndexOne[n] == 1)
{
btnTest.BackgroundImage = global::AnnunciatorMonitoringTool.Properties.Resources.lightbulb;
string str = "insert into ErrorLog values('" + annName + "','" + btn[n].Text + "','" + DateTime.Now.ToShortDateString() + "','" + DateTime.Now.ToShortTimeString() + "')"; ;
DataBaseHandling(str);
if (btn[n].BackColor == Color.LightGreen)
{
btn[n].BackColor = Color.Red;
}
else
{
btn[n].BackColor = Color.LightGreen;
}
}
else if (errorIndexOne[n] != 1)
{
btn[n].BackColor = Color.LightGreen;
}
}
I am trying to record each flashing event of the button in the database. The UI consists of few buttons in a panel & the panel is surrounded by rectangle making it look like a border around the panel. The panel size is changeable based on the no of buttons in it.
This timer2_tick event is fired when a particular data is coming from serial port. I am looking for a particular data from serial port if get that data i fire this timer event & further process the rest.
Jagadisha_Ingenious
25-Mar-13 0:46am
View
Then why does the timer stop when running? Is it because of the UI i have developed? Sometimes even the system hangs when the timer is running, why is that so...?
Jagadisha_Ingenious
23-Mar-13 0:57am
View
Deleted
Fine Sir, here is my mail id jagadisha.2805@gmail.com......... Send me a test mail i will send the details.
Jagadisha_Ingenious
22-Mar-13 7:35am
View
Sir send me ur mail Id i will forward you the entire solution.. I dont have line 462 in my Annunciator devices form.
Jagadisha_Ingenious
22-Mar-13 7:14am
View
Its is the same code from which i have started asking questions...
void Annunciator_Devices_Click(object sender, EventArgs e)
{
if (form2 == null || form2.IsDisposed)
{
form2 = new Annunciator_Window(descriptionName, btnName.Text, Port, devicescount, SlvID);
form2.MdiParent = MdiParent;
form2.WindowState = FormWindowState.Maximized;
// myPictureForm.FormClosing += form2_Closing;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
}
this.Hide();
form2.Show();
}
Jagadisha_Ingenious
22-Mar-13 6:03am
View
After stack trace i got this data in HTMl view.. by the way i have put that line of code in the button click event while migrating from 1 form to another.
" at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at AnnunciatorMonitoringTool.Annunciator_Devices.Annunciator_Devices_Click(Object sender, EventArgs e) in C:\AnnunciatorMonitoringTool\AnnunciatorMonitoringTool\Annunciator Devices.cs:line 462
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AnnunciatorMonitoringTool.Program.Main() in C:\AnnunciatorMonitoringTool\AnnunciatorMonitoringTool\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()".
Jagadisha_Ingenious
22-Mar-13 5:34am
View
I have put the breakpoint as u said but when i run it doesn't stop @ the breakpoint...
Jagadisha_Ingenious
22-Mar-13 5:29am
View
Deleted
Form2 has caused the disposal of the form....
Jagadisha_Ingenious
22-Mar-13 5:00am
View
public void DoGUIClear()
{
if (this.InvokeRequired)
{
GUIClear delegateMethod = new GUIClear(this.DoGUIClear);
this.Invoke(delegateMethod);................................... //@ this pont i get error.
}
And
public void DoGUIStatus(string paramString)
{
if (this.InvokeRequired)
{
GUIStatus delegateMethod = new GUIStatus(this.DoGUIStatus);
this.Invoke(delegateMethod, new object[] { paramString });.......@ here i get those errors.
//stswarning.Text = "How did he do that?";
//this.lblStatus.Text = paramString;
}
/* else
this.lblStatus.Text = paramString;*/
}
// this.lstRegisterValues.Items.Clear();
}
Once i might get in the 1st delegate function or i might get in the 2nd delegate function.
Jagadisha_Ingenious
22-Mar-13 4:53am
View
It shows error sometimes @ this point of the code...
public void DoGUIClear()
{
if (this.InvokeRequired)
{
GUIClear delegateMethod = new GUIClear(this.DoGUIClear);
this.Invoke(delegateMethod);
}
// this.lstRegisterValues.Items.Clear();
}
And sometimes @ this point of code...
public void DoGUIStatus(string paramString)
{
if (this.InvokeRequired)
{
GUIStatus delegateMethod = new GUIStatus(this.DoGUIStatus);
this.Invoke(delegateMethod, new object[] { paramString });
//stswarning.Text = "How did he do that?";
//this.lblStatus.Text = paramString;
}
/* else
this.lblStatus.Text = paramString;*/
}
Jagadisha_Ingenious
22-Mar-13 4:50am
View
Yes exactly i still get this problem...
Jagadisha_Ingenious
22-Mar-13 4:30am
View
I will close form2 & open form1. But the problem what i am facing is initially when i switch from form1 to form2 i get this error.
Jagadisha_Ingenious
22-Mar-13 3:21am
View
I have added the piece of code here..
Jagadisha_Ingenious
22-Mar-13 3:20am
View
I have added the piece of code here..
Jagadisha_Ingenious
22-Mar-13 3:03am
View
#region Delegate Functions
public void DoGUIClear()
{
if (this.InvokeRequired)
{
GUIClear delegateMethod = new GUIClear(this.DoGUIClear);
this.Invoke(delegateMethod);
}
// this.lstRegisterValues.Items.Clear();
}
public void DoGUIStatus(string paramString)
{
if (this.InvokeRequired)
{
GUIStatus delegateMethod = new GUIStatus(this.DoGUIStatus);
this.Invoke(delegateMethod, new object[] { paramString });
//this.lblStatus.Text = paramString;
}
/* else
this.lblStatus.Text = paramString;*/
}
public void DoGUIUpdate(string paramString)
{
if (this.InvokeRequired)
{
GUIDelegate delegateMethod = new GUIDelegate(this.DoGUIUpdate);
this.Invoke(delegateMethod, new object[] { paramString });
}
/* else
this.lstRegisterValues.Items.Add(paramString);*/
}
#endregion
This is the delegate function which i am using.
The following to switch.
private void btnOk_Click(object sender, EventArgs e)
{
if (form2 == null || form2.IsDisposed)
{
form2 = new Annunciator_Window(descriptionName, btnName.Text, Port, devicescount, SlvID);
form2.MdiParent = MdiParent;
form2.WindowState = FormWindowState.Maximized;
// myPictureForm.FormClosing += form2_Closing;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
}
this.Hide();
form2.Show();
}
Jagadisha_Ingenious
21-Mar-13 2:31am
View
@Sergey Alexandrovich Kryukov: Sir i have used this system.threading.timer as i told u earlier, but whats happening is it runs continuously for an hour or more than that n suddenly stops. Is it due to overflow of the timer...?
Jagadisha_Ingenious
18-Mar-13 10:20am
View
@Sergey Alexandrovich Kryukov: Hi, i am using system.threading.timer in my application. I have used one of them for receiving data from serial port & other timer making button change its back color continuously indicating fault as per my application. So do these timers perform as expected, run continuously?
Jagadisha_Ingenious
16-Mar-13 4:32am
View
@Sergy Alexandrovich Kryukov:I am using system timer for getting & windows form timer for updating UI. Which timer among the four available can do the work as told earlier?
Jagadisha_Ingenious
13-Mar-13 4:35am
View
@Bernhard Hiller:I have used system timer for data processing event & windows form timer for flashing of button..
Show More