|
I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
|
|
|
|
|
aeman wrote: I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
How can I guess? I have no idea how you have connected this device, whether it is powered on, whether it is working correctly, what sort of commands you send to it, or what responses you receive back. You will have to do some debugging for yourself in order to give us some more information.
The best things in life are not things.
|
|
|
|
|
What's an "LM35 temperature sesnor"?
|
|
|
|
|
|
Quite. Perhaps you could try that for C# code to interface with the parallel port.
|
|
|
|
|
ya well said. After doing that i came here.
|
|
|
|
|
|
yes i did that and i can access the parallel port also but i donot know how to display the values of sensor on pc??
|
|
|
|
|
Then you need to look up the documentation for the device you are interfacing with to find out what it will send you over the parallel port and how you want to represent that.
|
|
|
|
|
Cha, as if.
A while back I got around to buying one of these[^] in hopes that I could use it to sample and store outdoor temperatures. But it doesn't seem accurate and it only provides the temperature of the board, which warms up while it has power.
So I need to devise a way to only give it power when I want to gather a sample.
|
|
|
|
|
Hello Everybody,
I am creating a class in which i want to create a property of Name (Readable and Writable).
Which Will be Unique every time if i will be create this class.
and it will be checking for previous existing Object of Class.
if i create a class like :
Classname clsname = new Classname();
Classname clsname1 = new Classname();
then Output is
clsname.Name = Class1
clsname.Name = Class2
Then pls help me to do this work.
Thanks
If you can think then I Can.
|
|
|
|
|
Should be quite simple
public class Classname
{
public Classname()
{
this.Name = Guid.NewGuid().ToString();
}
}
Will this do?
|
|
|
|
|
What about...
public static class ClassNames{
private static int _count = 0;
public static string GetNextName(){
return "Class" + (_count++);
}
}
public abstract NamedClass{
public string Name {get;set;}
public NamedClass(){
this.Name = ClassNames.GetNextName();
}
}
public class Classname : NamedClass{
public Classname(){
}
}
...or something along those lines
If my jokes make me laugh, then I have already succeeded with 100% of my target audience
|
|
|
|
|
I use something similar to this to assign IDs to clients in my socket library, and in some other projects. Do note though that this isn't thread safe and it's better to use Interlocked.Increment if you want to call the ID generator from different threads.
|
|
|
|
|
Ah yes, a good point
If my jokes make me laugh, then I have already succeeded with 100% of my target audience
|
|
|
|
|
Hi all,
this error comes when i am using win32 dll in c# application.
An unhandled exception of type 'System.BadImageFormatException' occurred in Test.exe
Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
please help me for this.
thanks in advance.
|
|
|
|
|
32/64 bit mismatch!
you have to set the target cpu to x86, then it will work.
I cannot remember: What did I before google?
|
|
|
|
|
but both are build on same machine and platform.
|
|
|
|
|
if you are running a .net application, build for target "any cpu", the program will start as a 64 bit application - if the machine is running a 64 bit windows.
and if your win32.dll (doesn´t sound like an .net dll) is build for 32 bit (why do i think it is? maybe the 32 in win32.dll?, then it is not possible.
you have to build the .net app explicitly for x86 target. dot.
I cannot remember: What did I before google?
|
|
|
|
|
Hi
I am trying to set the BackColor of a specific cell (C2010 Enterprise), but have failed so far - can you help!
I have tried this:
DataGridView1[2, 3].Style.BackColor = Color.Red;
but that didnt work (doesnt appear to do anything)
Have you any other suggestions?
Cheers
|
|
|
|
|
Try setting the DefaultGridViewCellStyle - some code here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
How/Where are you determining which cell and trying to set it?
I usually do things like this to highlight a cell containing a value that is out-of-tolerance or such, i.e. like below 75 or whatever.
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
DataGridViewRow R = dataGridView1.Rows[e.RowIndex];
R.Cells[6].Style.BackColor = Color.Red;
}
Or do it like in the MSDN link in the CellFormatting event, which may be better.
|
|
|
|
|
Thanks for replying!
I have just tried your example, and that was fine. I have now gone back to my original and that seems to be working as well?! I dont know what I was doing before, but all is OK now
Cheers
Mike
|
|
|
|
|
Hi,
I am currently doing a project in C#.net. I am using a datagridview for data entry purpose.
The first column is a drop down combox column. After selecting the value from the list, I press Enter key. The cursor is not moving to next cell. It is moving to the next row of the same column. How to make it to move to the next column of the same row. Please help me.
private void frmInward_Load(object sender, EventArgs e)
{
txtInwardNo.Text=ReturnInwardNo();
LoadGridcolumns();
LoadSuppliers();
}
private void LoadGridcolumns()
{
string SQL;
OleDbConnection obcon = new OleDbConnection();
SQL = "";
SQL = "select '' as ItemGroup,'' as Item,Qty,Amount from InwardDetails";
obcon.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/MsBakery.mdb";
obcon.Open();
OleDbDataAdapter obda = new OleDbDataAdapter(SQL, obcon);
DataSet ds = new DataSet();
obda.Fill(ds,"InwardDetails");
dgvInwardDet.DataSource = ds;
dgvInwardDet.DataMember = "InwardDetails";
dgvInwardDet.AutoResizeColumns();
}
private string ReturnInwardNo()
{
string InwardNo;
InwardNo = "";
OleDbConnection obcon = new OleDbConnection();
OleDbCommand obcmd = new OleDbCommand();
string SQL;
bool status;
status = false;
try
{
obcon.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/MsBakery.mdb";
obcon.Open();
SQL = "SELECT TOP 1 InwardNo FROM Inward ORDER BY InwardNo DESC";
obcmd.CommandText = SQL;
obcmd.Connection = obcon;
OleDbDataReader obdr = obcmd.ExecuteReader();
if (obdr.Read())
{
InwardNo = Convert.ToString(Convert.ToInt32(obdr["InwardNo"].ToString()) + 1);
}
else
{
return "1";
}
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
status = true;
}
finally
{
obcon.Close();
if (!status)
{
obcon = null;
obcmd = null;
}
}
return InwardNo;
}
private void LoadSuppliers()
{
DataGridViewComboBoxColumn dgvcomcol = new DataGridViewComboBoxColumn ();
dgvcomcol.MaxDropDownItems = 5;
dgvcomcol.AutoComplete= true;
dgvcomcol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
dgvcomcol.DisplayIndex = 0;
dgvcomcol.HeaderText = "Supplier";
PrepareSupplierCombo(dgvcomcol);
dgvInwardDet.Columns.Add(dgvcomcol);
dgvcomcol.Width = 100;
}
private void PrepareSupplierCombo(DataGridViewComboBoxColumn col)
{
OleDbConnection obcon = new OleDbConnection();
string SQL;
obcon.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/MsBakery.mdb";
obcon.Open();
SQL = "SELECT SupplierName as Supplier,SupplierID FROM Suppliers";
OleDbDataAdapter obda = new OleDbDataAdapter(SQL, obcon);
DataSet ds = new DataSet();
obda.Fill(ds, "Suppliers");
col.Items.Clear();
col.DataSource = ds.Tables[0];
col.DisplayMember = "Supplier";
col.ValueMember = "SupplierID";
}
private void dgvInwardDet_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
ComboBox com = e.Control as ComboBox;
com.AutoCompleteMode = AutoCompleteMode.Suggest;
com.AutoCompleteSource = AutoCompleteSource.ListItems;
com.FlatStyle = FlatStyle.Flat;
}
With Regards,
Arun V
|
|
|
|
|
Hello bugindia,
if I understand you hitting enter to move to the next cell in the same row, handle the KeyDown event of your datagrid class SystemKeys and force by moving the cursor to the right and subsequently has an example here.
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{Right}");
e.Handled = true;
}
}
Bye
|
|
|
|