|
Actually if you look at the Managed DX samples in the new DirectX SDK there are some standard contrls that can be custom drawn that really do look cool. I think you might even get some/most of the functionality of that control, too.
Of course you could also do the same with all custom drawn controls and just forget about using DX.
Steve Maier, MCSD MCAD
|
|
|
|
|
|
Excellent! Now to decide if I jack my price for the learning curve or eat it because this will be fun to play with....
|
|
|
|
|
Hello!
I need help.
I have impoted the AxMS Comm Control 6 in MS Visual Studio .net 2003 and am using the control in C#. I tried to open ComPort #4 to receive GPS data through USB. However, I couldnt' open it, everytime, it gave me the following exception:
System.RunTime.InteropServices.ComException(0x800A1F45): HRESULT 0x800A1F45
Could somebody kind enough to help me solve this problem? Any suggestion would be appreciated!
Regards,
Stephen
|
|
|
|
|
i once (upon a time) had troubled with the comm control. are u sure it can be used for USB connections? Anyway, we used to troubleshoot the comm ports using HyperTerminal (an old unfriendly thing u can find in programs-accessories-communication), and u need to know what to send through this com port.
there are no facts, only interpretations
|
|
|
|
|
I've successfully invoked a COM method, which returns a ref to an object:
object oNames ;
...
axGTVX1.QueryAvailableList( ref oNames );
The object is an array of strings. In the VS.Net debug watch window, I can see the array and its values:
- oNames {System.Array} System.Object
[0] "Pole" string
[1] "Substation" string
...
However, I can't access it as an array (if I try to watch oNames[0], the message 'object needs an indexer' appears). I've tried various approaches to cast or index this object, to no avail. THIS SHOULD BE SIMPLE.
Tim
|
|
|
|
|
<br />
string [] aNames = ((string[])oNames);<br />
|
|
|
|
|
I tried that, and got a runtime error at that line:
System.InvalidCastException: Specified cast is not valid.
Thanks for the response.
|
|
|
|
|
Tim Atkins wrote:
System.InvalidCastException: Specified cast is not valid.
I'll admit I dont know the library you are dealing with, but the value being ref'ed out of that method isnt a string array if you are getting that error from that line of code.
|
|
|
|
|
Hello,
This may have been asked before, but my net access is too slow today, and I can't seem to find any answer, so here it is:
How can I get the file version of the current assembly (from the AssemblyVersion attribute)? I want to display it in the About box.
Thanks,
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
|
Hello leppie,
Thanks for your reply.
I tried this:
foreach(AssemblyVersionAttribute avat in Assembly.GetExecutingAssembly().
GetCustomAttributes(typeof(AssemblyVersionAttribute), true))
{
MessageBox.Show(avat.Version);
break;
}
and it doesn't work. The loop doesn't execute, as if it couldn't find any attributes of that type.
I have this on another source file in the same project (and it is displayed when I click Properties on my .exe in Windows Explorer):
[assembly: AssemblyVersion("1.0.4287.0")]
Any ideas?
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
I just put this piece of code in my About box to get the latest version..
this.lblVersion.Text = "Version "
+ (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString())
+ "."
+ (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString())
+ "."
+ (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
+ "."
+ (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString());
|
|
|
|
|
|
Hi,
is it possible to open a window containing all the files in a directory and letting the user choose a file to be renamed? I've written the code to open the window and display the files and I'm fairly sure the next step will involve the File.Copy or File.Move method but I can't work out the next few lines of code.
The selected file will always be renamed under the same term (ie somefile.txt) as there are more processes to be carried out on the file before it is finished with. The user can then select the next file in the list to be renamed and so the process continues ad nauseum (until I write the code to loop it. Rookies eh?)
The code thus far looks like the following, (sorry, I know you all know what this looks like, just thought it was better to include it than not)
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "CET File (*.cet)|*.cet|PET File (*.pet)|*.pet|All files|*.*";
sfd.Title = "Save File as";
sfd.FileName = @"c:\temp\thisfile.txt";
if(sfd.ShowDialog() == DialogResult.OK)
{
}
Like I say, I'm almost positive there is some clever use of the File.Move or File.Copy method to be invoked here. I got it to work when I coded in a specifically chosen filename but that obviously only works on one pass. I need it to be user-selected. Please can someone out there help?
Thank you in advance
Scotty
|
|
|
|
|
how about:
if(sfd.ShowDialog() == DialogResult.OK)
{
System.IO.File.Copy(myfile,sfd.FileName,true);
}
where myfile is a string with the original file name, and true alows overwriting? or have i misunderstood your question?
there are no facts, only interpretations
|
|
|
|
|
Hi,
yeah, that was it. My solution worked also when I realised I had declared a couple of variables to hold path names outside of the block of code I was working on. Once I put them in the right place, it all clicked together.
Thanks for replying anyhoo, much appreciated.
|
|
|
|
|
I have a problem, if someone will help i'm be very happy for it.
I want to read a binary file into a struct. Please help.
public sealed class InfoHeader
{
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
private struct Info
{
public UInt32 version;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=20)]
public Byte[] tapenr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=10)]
public Byte[] client0;
};
private Info info;
public void Read(BinaryReader reader)
{
int length = (int)Marshal.SizeOf(typeof(Header));
byte [] buffer = reader.ReadBytes(length);
// What is the next step get the buffer into the struct.
}
public void Write(BinaryWriter writer) ...
}
I don´t want to do this for every property.
this.version = reader.ReadUInt32();
Gywox
|
|
|
|
|
The only way I know is to copy the binary data into unmanaged memory, and then copy it back:
//get unmanaged memory
IntPtr pointer = Marshal.AllocHGlobal(length);
//copy the bytes into unmanagted memory
Marshal.Copy(buffer, 0, pointer, length);
//copy the bytes back into the structure
Info info = (Info)Marshal.PtrToStructure(pointer, typeof(Info));
|
|
|
|
|
When I return an object using get property how can I be sure
that it will not be changed outside (like const in C++)?
For example:
class A
{
private Hashtable ht;
public Hashtable Table
{
get
{
return ht;
}
}
}
|
|
|
|
|
You can't. That is one of very few things I dislike about C#. You can't reassign the Hashtable object itself, but you can still change its contents.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
You can't protect the object itself, but you can return a copy:
<br />
private Something s;<br />
public Something S{<br />
get{ return s.Clone(); }<br />
}<br />
For a Hashtable, you have to copy the content yourself. Hashtable.Clone() return only a flat copy.
<br />
public Hashtable Table{<br />
get{<br />
Hashtable htCopy = new Hashtable(ht.Count);<br />
foreach(object key in ht.Keys){<br />
htCopy.add(key, ht[key].Clone());<br />
}<br />
return htCopy;<br />
}<br />
|
|
|
|
|
Hello,
I have two tables From one table i want to retrieve two values and from the other also two values. And the condition is when the one value of the first table has a certain value. (In my case EngineerUserId). The problem is with my current statement the rows will be displayed two times.
Have anybody know an idea?
My current statement looks as follows:
"SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName FROM JobDescription p INNER JOIN Client c ON p.EngineerUserId = ? ORDER BY p.Priority";
thx
patrick
|
|
|
|
|
pat270881 wrote:
SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName FROM JobDescription p INNER JOIN Client c ON p.EngineerUserId = ? ORDER BY p.Priority
Do you mean the ? as a parameter placeholder of that you don't know what you should put there.
If it is the latter then:
INNER JOIN Client p.EngineerUserId = c.EquivalentColumnNameInClientTable
If you need to add a condition you should add a WHERE clause before the ORDER BY
so you might get something like this (I've assumed that the client table has a column called EngineerUserId, if it doesn't you need to replace it with the column that does contain that value)
SELECT p.JobId, p.Priority, c.CompanyName, c.ContactLName
FROM JobDescription p
INNER JOIN Client c ON p.EngineerUserId = c.EngineerUserId
WHERE p.EngineerUserId = ?
ORDER BY p.Priority
Oh, and by the way, this should really have gone in the SQL Forum[^]
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Okay, thank you, now it works!
Thx
patrick
|
|
|
|