15,900,907 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 steven8Gerrard (Top 52 by date)
steven8Gerrard
31-Jan-13 4:43am
View
So you are implying a is const? Value (i.e) 10 can change . if so how this one works ?
const int a=10;
int const *p=&a;
int b=20;
p=&a;
I still have doubts in pointer to constant . Source found in net is not clear
steven8Gerrard
31-Jan-13 2:15am
View
I'm actually learning in C . BTW they say it is a pointer to constant . So value should not change right?
steven8Gerrard
29-Jan-13 7:25am
View
Thanks for the reply. Much appreciated
steven8Gerrard
29-Jan-13 7:25am
View
Thanks for the reply. Much appreciated
steven8Gerrard
29-Jan-13 7:25am
View
Thanks for the reply. Much appreciated
steven8Gerrard
4-Jan-13 6:53am
View
Thank you . Much appreciated
steven8Gerrard
4-Jan-13 6:53am
View
Thank you . Much appreciated
steven8Gerrard
26-Dec-12 9:17am
View
TBH i have knowledge on ENUM and know how it works . I just haven't used enum in work . Here i just wish how if condition checks . Total enum structure will be compared against member of enum.
steven8Gerrard
21-Dec-12 10:11am
View
have searched it cant find the macro. It is not defined as far i know . say if i have defined. What it means? Does it link? What the macro does here?
steven8Gerrard
16-Dec-12 4:55am
View
Thanks . Much appreciated
steven8Gerrard
16-Dec-12 4:55am
View
Thanks . Much appreciated
steven8Gerrard
16-Dec-12 4:55am
View
Thanks . Much appreciated
steven8Gerrard
24-Nov-12 3:03am
View
STill getting error . Uninitialised Local variable used
steven8Gerrard
30-Oct-12 7:25am
View
Since space is given after "%f" . Cursor wait till third value is typed before printing a & b . Check it
steven8Gerrard
19-Oct-12 10:52am
View
Thanks . Nicely explained . My 5
steven8Gerrard
19-Oct-12 6:23am
View
volatile unsigned int * // Is this meant for typecast or function pointer?? I have a basic doubt
steven8Gerrard
29-Sep-12 15:24pm
View
Solution has been posted for C++ . I just want to know about memrev function in C
steven8Gerrard
26-Sep-12 14:05pm
View
I'm not talking about stack segment . I was talking about ZIGBEE stack :)
steven8Gerrard
19-Sep-12 3:36am
View
@Cpallini
Yes . Its used in developing STack.
steven8Gerrard
22-Aug-12 13:13pm
View
No . The value of data is 1 which is 0001 in binary and bit that needs to be set is 3rd bit if it sets it value should be 1000 (i.e) 8 by the logic i have written no?
steven8Gerrard
23-May-12 6:20am
View
I understand printf("%d",a++)etc how it works. My problem is here
printf("%d,%d,%d,%d",a++,++a,a--,--a);//4,5,4,5
In this line right to left order is used so first --a so it should print 4 but 5 is printed,then a-- it should also print 4 and minus. rightly printed 4,then ++a it should print 4 but printed 5 then a++ it should print 5 but printed 4
steven8Gerrard
23-Nov-11 10:06am
View
I dont actually need that much controls in my graph . I just need a line graph which connects two points . x & Y . X being temperature eceived from serial port and other current time . Any ideas?
steven8Gerrard
23-Nov-11 8:44am
View
I used this http://www.codeproject.com/KB/WPF/wpfgraph.aspx?msg=3116018#xx3116018xx . When i add library file WPFgraph.dll to reference but unable to use the class .
steven8Gerrard
23-Nov-11 4:25am
View
I dont have any problem in reading data . I have already read the data from serial post and stored it in a variable . My only problem is i dont know how to draw a graph . I used zedgraph in forms . I just want to add a graph control and pass the value to plot graph . My question is how to add a graph control or whatever ?? Can you get me??
steven8Gerrard
23-Nov-11 2:35am
View
This one doesn't support my requirement . I wish to use a third party control like zedgraph . Is there any available for WPF? By getting serial port data in a variable and chopping it . I can pass it to graph and plot it
steven8Gerrard
22-Nov-11 8:41am
View
I'm unable to add the graph control for ex like zedgraph . I use temp sensor i can chop temperature value and draw but my problem is with drawing the graph control . I cant get anything in this
A WPF Graph Control Library
[
^
]tutorial . Demo project has some errors too
steven8Gerrard
16-Nov-11 6:02am
View
I have created a page with a button inside a stack panel when i run the application in another system alignement is different . How to solve this issue?
steven8Gerrard
29-Sep-11 6:07am
View
Deleted
Added this to button click event
dataGridView1.Show();
DataGrid dg = new DataGrid();
SerialPort sprt = new SerialPort("COM3");
sprt.BaudRate = 9600;
sprt.Parity = Parity.None;
sprt.StopBits = StopBits.One;
sprt.DataBits = 8;
sprt.Handshake = Handshake.None;
sprt.Open();
string griddata = sprt.ReadExisting();
if (griddata != null)
{
try
{
int len = griddata.Length;
if (len > 40)
{
string[] splt_ = griddata.Split(':');
string chop_ = splt_[2];
string final_ = chop_.Remove(5);
//MessageBox.Show(final);
//float d = Convert.ToSingle(final);
d_ = Convert.ToDouble(final_);
myDataGridView.Rows.Add(d_, DateTime.Now);
}
}
catch
{
//MessageBox.Show("Not received data");
}
It shows Error The name 'myDataGridView' does not exist in the current context
steven8Gerrard
27-Aug-11 3:24am
View
Tried it but i get this error .
Error 1 The type 'AxSHDocVw.AxWebBrowser' exists in both 'c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\AxSHDocVw.dll' and 'c:\Documents and Settings\IWI\Desktop\FormUItest\FormUItest\obj\Debug\AxInterop.SHDocVw.dll' C:\Documents and Settings\IWI\Desktop\FormUItest\FormUItest\Form1.Designer.cs 3295 FormUItest
Any method to overcome this one
steven8Gerrard
23-Aug-11 6:29am
View
I have to use 15grids since i need 15 pages . Here i created grid1 and added two controls(checkbox and button)) and a Next button and added another grid which had a combo box control . I send grid2 to back order .
to back order . I nitially collapsed the visibility of combox and grid2 .
In the event handler of next button . I wrote
grid1.Visibility = Visibility.Collapsed;
button1.Visibility = Visibility.Collapsed;
checkBox1.Visibility = Visibility.Collapsed;
grid2.Visibility = Visibility.Visible;
comboBox1.Visibility = Visibility.Visible;
Still when i click on next button it shows a empty grid . Combobox is not visible
steven8Gerrard
16-Aug-11 6:50am
View
24 hours to 12 hours format is already done. but i want 12 hours to 24 hours.
steven8Gerrard
16-Aug-11 2:21am
View
In forms When we send the panel to back the controls in the panel will also go back nad it wont be visible in the above panel . Here in wpf when i send the grid to back the controls are not going even if it does . The control is visible on first grid . Any suggestions??
steven8Gerrard
16-Aug-11 1:43am
View
Deleted
It sounds good but in forms we are able to send the panel to the back or front by right clicking on the panel . No such things available for grid in WPF?? I cant find it . Goggle search doesn't give solutions too
steven8Gerrard
15-Aug-11 10:17am
View
I'd explain here . i have tabcontrol in my form which has 4 tab items .
In first tab i have a few checkbox and label .
Below i want a next button which i click on next button it should show different controls in same tab is it possible
steven8Gerrard
15-Aug-11 10:13am
View
I dont necessarily need a page . I need different controls in one tab say tab1 . When i click on next it should show some other controls . Thats what i need . ithink page is what would fit in
steven8Gerrard
15-Aug-11 4:30am
View
Not a browser application but my application should have a web look .
steven8Gerrard
14-Aug-11 4:58am
View
Not really browser application . I just wants to move pages in tab since i have different things to do in other tab
steven8Gerrard
6-Aug-11 3:57am
View
We should not change the tab it should remain in tab1 but when i click on next button another pane should appear . Is it possible on panel ??
steven8Gerrard
4-Aug-11 8:20am
View
Created a login page using XML. But i wish to create a login where four different users can login . Say user1 has access to all features whereas user2 has limited features stuffs like that . Created a login page using xml.
steven8Gerrard
31-Jul-11 5:07am
View
I'm unable to read the data using the above coding
steven8Gerrard
30-Jul-11 3:18am
View
I tried using your method but it has problems receiving the data from serial port . This is the code . Have i done it correctly .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
using System.IO.Ports;
using System.Threading;
namespace BGworker
{
public partial class Form1 : Form
{
List measures;
SerialPort sprt;
string indata,final;
double d;
BackgroundWorker worker;
public Form1()
{
InitializeComponent();
measures = new List();
//fill your PointPairList from the measures
zedGraphControl1.Location = new Point(10, 10);
// Leave a small margin around the outside of the control
zedGraphControl1.Size = new Size(ClientRectangle.Width - 20,
ClientRectangle.Height - 20);
ZedGraphControl zgc = zedGraphControl1;
GraphPane myPane = zgc.GraphPane;
myPane.Title.Text = "Zedgraph";
myPane.XAxis.Title.Text = "Battery";
myPane.YAxis.Title.Text = "Temp";
double x, y1;
PointPairList list1 = new PointPairList();
worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
//put all your serial port code here
sprt = new SerialPort("COM3");
sprt.BaudRate = 9600;
sprt.Parity = Parity.None;
sprt.StopBits = StopBits.One;
sprt.DataBits = 8;
sprt.Handshake = Handshake.None;
try
{
sprt.Open();
}
catch (Exception)
{
MessageBox.Show("Check port");
}
indata = sprt.ReadExisting();
//MessageBox.Show(indata);
string[] splt = indata.Split(':');
string chop = splt[2];
final = chop.Remove(5);
d = Convert.ToDouble(final);
//when you want to update the measures list
lock (measures)
{
measures.Add(d);
}
//sometimes update the graph
BeginInvoke((Action)(() =>
{
lock (measures)
{
for (int i = 0; i < 3; i++)
{
x = (double)i + 3.5;
//y1 = 5;
//d = 10;
list1.Add(x, d);
}
LineItem myCurve = myPane.AddCurve("Porsche",
list1, Color.Red, SymbolType.Diamond);
}
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
}));
};
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
sprt.Close();
}
private void button1_Click(object sender, EventArgs e)
{
worker.RunWorkerAsync();
}
}
}
steven8Gerrard
29-Jul-11 8:25am
View
Deleted
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
using System.IO.Ports;
using System.Threading;
namespace BGworker
{
public partial class Form1 : Form
{
List<float> measures;
SerialPort sprt;
string indata,final;
double d;
BackgroundWorker worker;
public Form1()
{
InitializeComponent();
measures = new List<float>();
worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
//put all your serial port code here
sprt = new SerialPort("COM3");
sprt.BaudRate = 9600;
sprt.Parity = Parity.None;
sprt.StopBits = StopBits.One;
sprt.DataBits = 8;
sprt.Handshake = Handshake.None;
try
{
sprt.Open();
}
catch (Exception)
{
MessageBox.Show("Check port");
}
indata = sprt.ReadExisting();
string[] splt = indata.Split(':');
string chop = splt[2];
final = chop.Remove(5);
d = Convert.ToDouble(final);
//when you want to update the measures list
lock (measures)
{
measures.Add();
}
//sometimes update the graph
BeginInvoke((Action)(() =>
{
lock (measures)
{
//fill your PointPairList from the measures
zedGraphControl1.Location = new Point(10, 10);
// Leave a small margin around the outside of the control
zedGraphControl1.Size = new Size(ClientRectangle.Width - 20,
ClientRectangle.Height - 20);
ZedGraphControl zgc = zedGraphControl1;
GraphPane myPane = zgc.GraphPane;
myPane.Title.Text = "Zedgraph";
myPane.XAxis.Title.Text = "Battery";
myPane.YAxis.Title.Text = "Temp";
double x, y1;
PointPairList list1 = new PointPairList();
for (int i = 0; i < 36; i++)
{
x = (double)i + 5;
y1 = 5;
list1.Add(x, y1);
}
LineItem myCurve = myPane.AddCurve("Porsche",
list1, Color.Red, SymbolType.Diamond);
}
zedGraphControl1.AxisChange();
zedGraphControl1.Invalidate();
}));
};
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
sprt.Close();
}
private void button1_Click(object sender, EventArgs e)
{
worker.RunWorkerAsync();
}
}
}
This is my code ......
steven8Gerrard
29-Jul-11 8:17am
View
Thanks for the reply . never used BGworker before tried this .
Cant understand this line measures = new List<float>();
and when i use measures.Add(...); it shows error . What identifier should i give
steven8Gerrard
23-Jul-11 3:09am
View
Works fine thanks for all links
steven8Gerrard
22-Jul-11 8:17am
View
Deleted
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace Datareceive
{
public partial class Form1 : Form
{
SerialPort sprt;
string indata;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
sprt = new SerialPort("COM3");
sprt.BaudRate = 9600;
sprt.Parity = Parity.None;
sprt.StopBits = StopBits.One;
sprt.DataBits = 8;
sprt.Handshake = Handshake.None;
sprt.DataReceived += new SerialDataReceivedEventHandler(sprt_DataReceived);
sprt.Open();
//richTextBox1.AppendText(indata);
//string nm = fn();
}
private void sprt_DataReceived(
object sender,
SerialDataReceivedEventArgs e)
{
SerialPort sprt = (SerialPort)sender;
//string indata = sp.ReadExisting();
//Console.WriteLine("Data Received:");
//Console.Write(indata);
//sprt = (SerialPort)sender;
indata= sprt.ReadExisting();
//string a=gg
//richTextBox1.AppendText(indata);
MessageBox.Show(indata);
//return indata;
//return a;
//try
//{
// richTextBox1.AppendText(indata);
//}
//catch (Exception)
//{
// MessageBox.Show("error");
// sprt.Close();
//}
//Console.Write(indata);
}
private void delegate SetLabelDelegate(RichTextBox rich, string text);
private void SetLabelText( RichTextBox label, string text)
{
if( rich.InvokeRequired)
{
rich.Invoke(
new SetLabelDelegate( SetLabelText),
new object[]{ rich, text }
);
return;
}
textBox.AppendText(text);
}
private void button2_Click(object sender, EventArgs e)
{
sprt.Close();
}
}
}
THIS is the code dont know where it goes wrong . Its been since i'm trying for this solution :(
steven8Gerrard
22-Jul-11 7:44am
View
@lukerr
Still errors Invalid token 'delegate' in class, struct,
Cant get a grip of delegates . This delegates concept is confusing :(
steven8Gerrard
21-Jul-11 6:13am
View
I tried this method But giving me errors . Can you tell me what is wrong ??
Added this for read button click
sprt = new SerialPort("COM3");
sprt.BaudRate = 9600;
sprt.Parity = Parity.None;
sprt.StopBits = StopBits.One;
sprt.DataBits = 8;
sprt.Handshake = Handshake.None;
sprt.DataReceived+=new SerialDataReceivedEventHandler(sprt_DataReceived);
sprt.Open();
Then created thisdatareceivehandler
private void sprt_DataReceived(
object sender,
SerialDataReceivedEventArgs e)
{
indata= sprt.ReadExisting();
richTextBox1.AppendText(indata);
//Console.Write(indata);
}
Getting errors : Control 'richTextBox1' accessed from a thread other than the thread it was created on.
I dont think i have created any thread . I'm a beginner so can you say why it is showing errors
steven8Gerrard
19-Jul-11 8:04am
View
Yep c++ . Working on both c++ and c# but posted the c++ code here
steven8Gerrard
5-Jul-11 4:33am
View
Tried docking method and it works so far . Another question i have added two pic in my forms when i maximise right pic stays where it is doesn't move so form looks different any method to solve that problem
steven8Gerrard
1-Jul-11 9:22am
View
I'm using vc++. I tried to translate c# into c++ but failed any c++ examples would be helpful
steven8Gerrard
23-Jun-11 5:19am
View
when i click on the tabpage1 or say tabpage2 it should display a textin richtextbox "you have clicked on tab2" . Now i dont get any such text
steven8Gerrard
27-May-11 4:21am
View
Its not that i haven't tried . I couldn't understand a thing in those above articles . This is what i did . After creating form clicked on the read data button. It took me to code .
Added
using namespace System::IO::Ports;
using namespace System::Threading;
To header file
Added this below initialise components
static bool _continue;
static SerialPort^ _serialPort;
Wrote this in button eventhandler
_serialPort = gcnew SerialPort();
_serialPort->PortName = SetPortName(_serialPort->COM3);
_serialPort->BaudRate = SetPortBaudRate(_serialPort->9600);
_serialPort->Parity = SetPortParity(_serialPort->NOPARITY);
_serialPort->DataBits = SetPortDataBits(_serialPort->8);
_serialPort->StopBits = SetPortStopBits(_serialPort->ONESTOPBIT);
_serialPort->Open();
_continue = true;
_serialPort->ReadByte();
textBox1->Text = ReadByte.ToString();
}
And ran the program got 23 errors saying serial port undeclared identifier..
Someone help me
Show More