|
Just tried it on a form and it works for me:
public Form1()
{
InitializeComponent();
KeyPreview = true;
KeyDown += new KeyEventHandler(Form1_KeyDown);
}
void Form1_KeyDown(object sender, KeyEventArgs e)
{
Console.WriteLine(e.KeyData);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I think he missing this one "KeyPreview = true;"
I know nothing , I know nothing ...
|
|
|
|
|
_PreviewKeyDown works for me
|
|
|
|
|
Hi dear all,
i have a RFID reader. in my project i have to read data from smart card and also write data in the card.
i attached the reader to com port "com 3".
and i am using ..
private SerialPort comport = new SerialPort();
for the communication.
i am using the object "comport" to read and write data..
the read is..
// Read all the data waiting in the buffer
string data = comport.ReadExisting();
and write is..
// Send the user's text straight out the port
comport.Write(txtSendData.Text);
<big><b>But i want to read data from a specific block of SMART CARD.</b></big>.
How it is possible...
any one can help me...
thanks!
|
|
|
|
|
usually theres a manual and/or SDK that comes with such a device - you could look to see if the manufacturer has a website where they post the details.
'g'
|
|
|
|
|
Dear All,
I am developing an application which communicates with database in web server.
my concern is followings
1. initate access from client or simply remote client.
2. execute a procedure which create an xml of select statement in server in a specific directory.
what i want is when the user initates access to web database, due to lack of internet connectivity the second phase has to be done offline.
What i have done yet, i have created a dll file, assembly and then created store procedure from that assembly which create xml file based on the select statement.
now i am searching for a method that the second option should be done offline, while the cient need to initiate access first.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi All,
i created a painter program, with classes and all shapes.
i save the shapes in arraylist for undo redo.
i tried to serialize the objects using the following code,
just to see if it works, and i get error
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PaintBrush
{
public class SaveBinary
{
FileStream fs = new FileStream("Data", FileMode.Create);
BinaryFormatter BF = new BinaryFormatter();
BF.Serialize(fs, "1234");
fs.Close();
}
}
it won't recognize BF at all, and i don't see why (using visual studio 2008)
Error on compile:
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(23,21): error CS1519: Invalid token '(' in class, struct, or interface member declaration
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(23,24): error CS1519: Invalid token ',' in class, struct, or interface member declaration
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(24,17): error CS1519: Invalid token '(' in class, struct, or interface member declaration
Compile complete -- 3 errors, 0 warnings
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks,
Retaliator
|
|
|
|
|
Buy a very basic book on C#, preferably one with pictures, and read it.
alonchap wrote: public class SaveBinary
{
// Create file to save the data
FileStream fs = new FileStream("Data", FileMode.Create);
// Create binary formatter object:
BinaryFormatter BF = new BinaryFormatter();
BF.Serialize(fs, "1234");
fs.Close();
}
Can you honestly not see what's wrong here ? You're writing code inside the class declaration, but not inside a method. Your code is invalid, which is what the compiler told you.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hey i did not notice, just saw it now,
so it's working basiclly i can save a string now and deserialize as well,
how would i do a loop to serialize each object (class which is shape) inside the array list?
|
|
|
|
|
I would serialise the entire array, and then deserialise it as an array also.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Can you point how? coz it needed casting or something because it did not allow serialize the ShapesList (which is the arraylist)
|
|
|
|
|
The ArrayList class sucks, don't use it. I suspect if you use a generic list, it will work fine, b/c it is strongly typed and will know it's contents can be serialised. If not, just build an array, and serialise that.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
I Managed, thanks
modified on Saturday, June 6, 2009 5:08 PM
|
|
|
|
|
Hi,
This is my scenario. I have a Win32 console application and I would like to call functions in this project by a C# widows application. I have tried p/invoke but I seem to get an error saying that the entry point was not found. Added the C++ project to the C# solution but couldn't get it working. Any suggestions on how to get it working ?
Thanks in advance,
indikat
|
|
|
|
|
indikat wrote: I have tried p/invoke but I seem to get an error saying that the entry point was not found.
yeah - a console app doesnt expose 'entry points' (well, I guess you could call 'main' an entry point, but that doesnt help you )
it sounds like what you really need is to put the functions (assuming you have the source) from the console app into a dll. If you cant do that, then you need to do something like run the console app as a process and capture stdout etc to get the results back ..
'g'
|
|
|
|
|
I'll try and add the necessary functions into a dll. Is there any way that I can add the C++ project to the solution and use the C++ functions from C# project ?
indikat
|
|
|
|
|
not really, if you want to keep them in c or c++ - you must export them from a dll - or you could simply re-write them in c#
|
|
|
|
|
Thanks for the info. I have managed to create a dll and export the needed function.
Might need to rewrite the code in C# later on.
indikat
|
|
|
|
|
|
|
hi..i am doing a project named as news mangement system.it is mainly aimed at the content manipulation of a web news paper on the internet.the technology used are asp.net with c# using ajax,web services,sql server 2000.i am beginner and i need ur help to complete my project.i hope u will give me the suitable suggestions and helps to me.
|
|
|
|
|
You will find all the help you need here[^].
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hello,
I need to add datagridviewcolumns in a loop. For example:
string[] default_columns { "VlFile", "EquipName", "JobName", "NickName", "Operator", "EquipmentStartTime", "JobComment", "EquipTypeDesc" };
foreach (string s in default_columns)
{
}
The columns need to be bounded. I have the bound source and all this but the problem is adding the columns.
It will loop me through the array (default_columns) and will add this columns.
How can i do it?
I mean there is a problem because i need to declare a variable
|
|
|
|
|
I would create a datatable and point the datagridview to it
DataTable DT = new DataTable();
foreach (string s in default_columns)
{
DataColumn NewCol = new DataColumn(s);
DT.Columns.Add(NewCol);
}
DataGridView.DataSource = DT;
Regards
Mick Curley
|
|
|
|
|
OK but i load data to the datagridview from a database. And i need the columns to be bound to the database.
I declared the database (datatable) as a bindingsource to the datagridview.
But i need to add columns in the program (the user will choose which columns he wants to see)
|
|
|
|