|
|
That's no different that what you already said. What does the Message property in the IOException say?
|
|
|
|
|
The problem is the Message property return "IoException"...
|
|
|
|
|
OK. SO now, without seeing the code that throwing the exception, there's really nothing to tell you. There's about a 20 different reasons this can fail.
|
|
|
|
|
Is there an InnerException? Maybe if you could copy the exception details to the clipboard and paste it here, we could better help you out.
|
|
|
|
|
This is the code i have writte,
<br />
<br />
<br />
<br />
<br />
static byte[] bufferBurst = new byte[22] { 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B, 0x5B };<br />
static void Main(string[] args)<br />
{<br />
string portCom = "COM";<br />
RegistryKey regkey = Registry.LocalMachine.OpenSubKey("Drivers\\BuiltIn\\IrCoMM");<br />
<br />
if (regkey != null)<br />
{<br />
portCom += ((int)regkey.GetValue("Index")).ToString();<br />
regkey.Close();<br />
}<br />
SerialPort sr = new SerialPort(portCom);<br />
try<br />
{<br />
<br />
sr.RtsEnable = true;<br />
sr.DtrEnable = true;<br />
sr.BaudRate = 19200;<br />
<br />
sr.Open();<br />
sr.Write(bufferBurst, 0, bufferBurst.Length);<br />
sr.Close();<br />
<br />
}<br />
catch ( IOException io)<br />
{<br />
Console.WriteLine(io.Message);<br />
sr.Close();<br />
}<br />
}<br />
and the exception is:
InnerException = null
Message = IOException
HResult = -2146232800
When i start i think this type of hardware " IRDA" is very simple, but now.. and the home site to irda i have pay to acesse, but i'm not the soluctions for my problem is there..
|
|
|
|
|
If you step through code in the debugger, it finds the registry key? If it doesn't, the serial port would be trying to use COM, which I don't believe will work (needs to be COM1, COM2, etc. right?)
Another thing to try would be different baud rates.
Of course, there is something physically connected to the serial port, right?
|
|
|
|
|
Hi all,
Is there an equivalent in C# to the old, stupendously useful C++ __FILE__ and __LINE__ (and __FUNCTION__) preprocessor macros?
At the moment, I'm creating a StackFrame and reading information out of that, but it seems a bit silly to do that when the code location is known by the compiler at compile-time.
Thanks in advance
|
|
|
|
|
|
hmm thanks. the solutions proposed all use the stack frame I ended up using. Sounds like a good feature to add to the preprocessor next time around (because the stack frame hack obviously won't work consistently in release builds).
|
|
|
|
|
It should work consistently in release builds provided you supply the app's .pdb with the release build, I believe.
|
|
|
|
|
Release build optimisations (at the very least, inlining code) will screw with the expected stack. I wouldn't hold out any hope of stack frames acquired in release builds to be accurate.
|
|
|
|
|
|
Hi,
I'm currently making an application that simulates a virtual drive using a file as storage and FAT32 as filesystem. I've made an explorer-like user interface, and I want to implement drag and drop from my application to explorer, but I cannot use the .net drag and drop directly since I store the items with a custom format as I said above.
I've thought of using the DragLeave event to create the dragged file as a temporary file and actually drop this temporary file.
Is this ok? Or is there a better way of doing it?
Thanks in advance.
|
|
|
|
|
you can Use MemoryStream to stroe your File Bytes in it
I know nothing , I know nothing
|
|
|
|
|
Hi...
Newbie to C#..so please be kind...
I am trying to get a list of files that start with letters only (avoiding files that start with ~ for example). Here is my simple code, which of course does not work:
<br />
DirectoryInfo dir = new DirectoryInfo("C:\Some Directory");<br />
FileInfo[] files = dir.GetFiles("[^a-zA-Z]*.doc");<br />
What am I missing?
TIA for any help. Sorry if this has been posted. I searched, but could not find....
J
|
|
|
|
|
Hi,
AFAIK you can use wildcards in GetFiles, the same you can in a DOS window,
or the Explorer's search pane, but nothing more fancy.
So you end up with two choices:
- do GetFiles("*.doc") and skip the files you dont like; (you would need
Path.GetFileName to extract the short file name again);
- create a loop with myChar going from 'a' to 'z' and do GetFiles(""+myChar+"*.doc"),
or alternatively construct a constant string that holds acceptable starting letters
and do a foreach myChar on it.
|
|
|
|
|
Thanks! Thats kinda what I thought, but figured I would ask to see....
|
|
|
|
|
Hi,
I'm implementing a drag object operation with panels.
The code i'm using for that is:
<br />
private void panel_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
Panel region = (Panel)sender;<br />
<br />
drag = true;<br />
panelBeingMoved = region;<br />
<br />
x = e.X;<br />
y = e.Y;<br />
}<br />
<br />
private void panel_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
drag = false;<br />
panelBeingMoved = null;<br />
}<br />
<br />
private void panel_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (drag) {<br />
panelBeingMoved.Left += e.X + x;<br />
panelBeingMoved.Top += e.Y -y;<br />
<br />
x = e.X;<br />
y = e.Y;<br />
}<br />
}<br />
The problem is that the panel behaves in a very strange way. Instead of coming togheter smoothly with the mouse it is always jumping around with some pattern that i can justify.
Is there any simple explanation for this bahaviour?
What am i missing?
Thx,
Nuno
|
|
|
|
|
Hi
this is a different , method to move Control
hope it will help ,
Class1.cs
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
public class Class1<br />
{<br />
public static int HTCAPTION = 2;<br />
public static int WM_NCLBUTTONDOWN = 0xA1;<br />
[DllImport("user32.dll")] <br />
public static extern int ReleaseCapture () ;<br />
[DllImport("user32.dll")] <br />
public static extern int SendMessage (IntPtr hWnd, int wMsg , int wParam, ref int lParam ) ;<br />
public Class1()<br />
{<br />
}<br />
}<br />
Example :
private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
<br />
int reflParam = 0;<br />
Class1.ReleaseCapture ();<br />
Class1.SendMessage (panel1.Handle , Class1.WM_NCLBUTTONDOWN , Class1.HTCAPTION , ref reflParam );<br />
}<br />
P.S
JUST TRY IT ... it's work like charming even if it look dos not
Have a good day ....
I know nothing , I know nothing
|
|
|
|
|
Hi,
Yes, this solution worka like charms. The only problem is that i don't understand what i am doing.
How can i get reference documentation for this? How can i know what more can i do with this?
I would love to be able to resize for example. Like you do when you choose a transform operation in Photoshop for example.
Thx,
Nuno
|
|
|
|
|
hi ( and thank you for testing my code )
no worries , if you don't understand it ...
cause my code was C++ and Win32 API , more than C# code
you can find many of this stuff ,
by searching in ( MSDN , Win32 API , C++ code .... etc )
have a good day
I know nothing , I know nothing
|
|
|
|
|
Hi guys,
I need some help please, I have a treeview and for each node I want to show tooltip data; this data is stored in a table and I don't think querying the table everytime the mouse is moved is a good idea. I was wondering if anybody knew a different way of showing the tooltip with database table data.
Please help!!!
sasa
|
|
|
|
|
hi
when you building your treeview
try to store your tooltip in ArrayList
then query the tooltip from this ArrayList
Have a good day ....
I know nothing , I know nothing
|
|
|
|
|
Thank you for your response. I have never used an arraylist before I googled and found some information but none shows on how to query an arraylist. Could you please give me an example.
sasa
|
|
|
|
|