|
I should have said this in the first post, but I already have established a working com connection. I can send/recieve data through the port. What I really need help with is graphing the data.
With the custom control overriding, how exactly does that work? WOuld you be able to provide me with a sample code?
|
|
|
|
|
There are numerous articles on Code Project dealing with custom drawing in OnPaint for controls. The event argument contains a Graphics object which is very easy to use just by looking at the method signatures.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
I will do some more research. thank you for the advice on the custom drawing controls.
|
|
|
|
|
|
Thanks for the link. Have you used ZedGraph before?
|
|
|
|
|
Yes I am using it now for some data graphing.
It is Open Source and it has lots of potential. Another possible solution might be .. MS released a chart control a month or 2 ago. I've tried it but for what I'm doing there was just to much overhead but it might be worth giving it a shot.
Hope This Helps
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
|
The following snippet is intended to read the current maximum value and increment it by 1 so that it uses it to store in the database.
I need to convert the result of rawValue to an integer, increment it by 1, an, include it as a parameter.
any ideas?
object rawValue = getTaskRefSQL.ExecuteScalar();
if (rawValue != DBNull.Value)
{
myValue = (System.Data.Sqltypes.SqlInt64) rawValue;
myValue++;
}
cmdCreateNewTaskQuery.Parameters.AddWithValue("@taskID_PK", myValue);
Jon
|
|
|
|
|
myValue = (long) rawValue;
Using this method to create your primary key isprone to errors, use an auto-incrememnting identity field where possible.
|
|
|
|
|
this works good for me...int.Tryparse will try and convert to an integer, returning true if it succeeds and false otherwise, you can probably do long etc too
here i feed in a string, and try to convert to an int...
booResult = (int.TryParse(strSpO2, out intSpO2));//feed in string, and request an int out
if (booResult == true)//then it is numeric
|
|
|
|
|
Is there a way to change the horizontal arrow symbol position in a sortable ListView column header? I want the arrow to be closer to the header text.
|
|
|
|
|
Good Morning/Afternoon/Evening,
I'm trying to copy the contents of an unbound DataGridView of one form into an unbound DataGridView on it's child form. I've been looking all over for a solution, but I can't figure the darn thing out. It should be a simple task, should it not?
Please help!
|
|
|
|
|
Lodeclaw wrote: It should be a simple task, should it not?
What should be simple? Copying the data probably is simple. Finding an example of it, probably not so simple since best practice would be to use an MVC design.
|
|
|
|
|
I don't know if it's simple or not, which is why I asked. I'm hoping someone can point me in the right direction so I can figure it out. All I want is an exact copy of a datagridview in one form to appear on another form.
|
|
|
|
|
Lodeclaw wrote: I'm hoping someone can point me in the right direction
Well if I were planning on copying a DataGridView, I wouldn't do that but if say for some hypothetical insane reason I was planning on it, I would start at the documentation for the DataGridView class.
|
|
|
|
|
I've looked through the documentation already. Since there's no help to be had here, I'll try a different route. Thanks anyway, Mike.
|
|
|
|
|
Lodeclaw wrote: I've looked through the documentation already
Did you find this?[^]
I'm not saying that's a good way to go about this, however it does seem to have some possibilities doesn't it?
|
|
|
|
|
I don't seen anything there that will help me in the copying process of an entire datagridview. I am filling my initial dgv in that manner.
In any case, I was hoping to find an easy way to transfer the data for easy viewing on an invoice form, but since as you said there are no examples of code... I'm now using a for loop to collect the data from my rows and populate the child form's dgv. It's probably better this way in the long run.
Thanks for the help, Mike.
|
|
|
|
|
Hello everyone,
1- Assuming the following DLL
<br />
namespace test_dll<br />
{<br />
public class test<br />
{<br />
public static int test_add(int a, int b)<br />
{<br />
return (a+b);<br />
}<br />
}<br />
}<br />
2- After compiling, I get (test_dll.dll)
3- I copy the dll and paste it in (test_program) (bin/debug) -test_program is a different project-
4- From the test_program program logic I do the following
<br />
namespace test_program<br />
{<br />
<br />
public class test_dll_user<br />
{<br />
[DllImport("test_dll.dll",EntryPoint="test_add")]<br />
extern static int test_add(int x, int y);<br />
<br />
public int MyAdd(int a, int b)<br />
{<br />
return test_add(a,b);<br />
}<br />
}<br />
}<br />
Now! The code compiles fine!
Once I would like to use the MyAdd function
<br />
Line 1: test_dll_user obj = new test_dll_user();<br />
Line 2: obj.test_add(1,2);<br />
I get a compiler Error (Unable to find an entry point named 'test_add' in DLL 'test_dll.dll')!
I been looking all over the place for a solution with no luck!
Moreover, for business reasons, I don't want to add the dll as a reference! What can I do? Any help would be exteremly appreciated. Thanks
|
|
|
|
|
Hi,
you are mixing to incompatible things:
1. DllImport is needed when you want to access native code in some DLL file, e.g. a Win32 API function in user32.dll
The DLL you want must be found by the normal Windows search, i.e. it should be in a folder that is listed in the environment variable PATH.
2. However, when compiling managed code, as you did in namespace test_dll { public class test...
the result is a managed DLL (unless you made it create an EXE), which you can reference from another project, and just use the types it contains. You typically need two things:
- add the reference in the solution pane
- add a using statement to import your namespace
Now start creating types as in test t=new test(); Console.WriteLine(t.test_add(1,2));
BTW this is elementary; have you studied a tutorial on C# at all? your naming conventions are non-
existing. At least read some of the CodeProject articles!
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:58 AM
|
|
|
|
|
Hi,
I am new to c#, my reading on the subject is not that great! But, it looks like you didn't read my question. At least well!
1- I am aware of both advices! But... thanks anyway.
2- I do not want to use the REFERENCE statement or add the dll as a reference
(it was very clear in my question)
using test_dll; // this is out of the picture!
3- The naming conventions, what difference does it make!
4- I don't see the incompatibility at all! If you are familiar with using C++ dlls from c#, then,
the question goes like this:
I want to do the same thing in c# without A: referencing B: using the "using" statement
Thanks for the reply.
|
|
|
|
|
Hi,
as I said DllImport will not work for managed code.
If you don't want a static reference, you need reflection.
It's not really beginner's stuff though.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:58 AM
|
|
|
|
|
Thanks for the reply.
could you provide me a code example please!
|
|
|
|
|
Thanks folks. Reflection was the way to go: here is an example (Hopefully, it will benefit someone)
public class Example
{
public string GetFileName()
{
Assembly assem = Assembly.LoadFrom(@"C:\Test.dll");
Type typClsX = assem.GetType("Test.Class1", true);
object oClsX = Activator.CreateInstance(typClsX);
MethodInfo miGncn = typClsX.GetMethod("ReturnFileName", new System.Type[0]);
string intAddFunc = (string)miGncn.Invoke(oClsX,null);
return intAddFunc;
}
public int DoAdd(int x, int y)
{
object[] Parms = {x,y};
Assembly assem = Assembly.LoadFrom(@"C:\BasicMath.dll");
Type typClsX = assem.GetType("BasicMath.Operations", true);
object oClsX = Activator.CreateInstance(typClsX);
MethodInfo miGncn = typClsX.GetMethod("DoAdd");
int intAddFunc = (int)miGncn.Invoke(oClsX, Parms);
return intAddFunc;
}
}
|
|
|
|
|
Lookup reflection - thats the way to dynamically instantiate .NET classes without the need to reference them.
|
|
|
|