|
Did you set the forms KeyPreview property to True?
Roy.
|
|
|
|
|
I have an array of bit values - well actually a bool array, 8 elements long. How can I convert this into it's byte representation?
So basically, I want to do a binary to decimal conversion. How can I do this?
/\ |_ E X E GG
|
|
|
|
|
Create a BitArray from the array of booleans and use the CopyTo method to store the value in an array of byte (with the size of one).
---
b { font-weight: normal; }
|
|
|
|
|
OK Thanks. I found a nice library on this site also...
/\ |_ E X E GG
|
|
|
|
|
If it's just an 8-bit to byte conversion this will do the job:
byte value = 0;
bool[] bits = { false, true, true, false, true, false, false, true };
for (byte b = 0; b < bits.Length; b++)
{
value <<= 1;
if (bits[b])
value |= 0x1;
}
This will also work if you change byte to int and increase the array length to a maximum of 32 boolean values
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
ok next q ... how do you access inputs into a constructor
within the base class?
my base class constructor:
protected int commonID; // this is common to all object
public BaseClass{
console.write commonID; // or something that accesses id
}
my sub-class constrictor:
public myClass(int id)
{
commonID = id;
}
but when I instantiate "myClass", before it sets commonID, it goes
to the BaseClass constructor. But commonID is null cause it hasnt
been set.
So is there a way for me to get "id" into the baseclass? or get commonID
set?
M
|
|
|
|
|
Here are your two constructors rewritten:
public BaseClass(int id)
{
commonID = id;
console.Write(commonID);
}
public myClass (int id) : base(id)
{
}
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
dude, that was perfect, it worked.
thanks!
Moazzam
|
|
|
|
|
base class:
protected int commonID; // this is common to all object
public BaseClass{
}
public void DoOtherThing {
console.write commonID; // or something that accesses id
}
///////////////////////////////////////////////
sub-class:
public myClass(int id)
{
commonID = id;
DoOtherThing();
}
Was it a cat I saw?
|
|
|
|
|
But with this code the purpose of having the base class is somewhat lost as your method requires the subclasses to specifically call DoOtherThing() rather than properly inherite the behaviour of the base constructor.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
ADD button is the last control which i click in my page, after I click ADD button if I refreshed the page again ADD buttonEvent is being executed.I don't want this. How to avoid last event from execution when page is refreshed.
Srilakshmi
|
|
|
|
|
I think that's a standard behavior of Internet Explorer so that should be impossible to achieve your goal. But you can put a hyperlink to itself in each page and click it instead of click "Refresh".
Was it a cat I saw?
|
|
|
|
|
Workarounds
1. You can redirect user to someother page after clicking add button. Like "Thanks, values saved" is displayed on that page.
2. You can set an session variable, And increment that value, so if that value is set to 1, you can stop the value from entering into db.
|
|
|
|
|
I m using dataGrid control in my application. I want user to add records using Data Grid. Right now my Grid has 5 columns. Problem is that if user fills only one column and click add button, Grid does not add that row. Infact if i click on some other control that row from grid just disappeared. But if i fill all colums then a blank row appear down that row. and now if i click add button, this row will be added.
Now i just want a row to be added if i only fill one column. What should i do?
Day by Day Everyone is moving towards graveyard
|
|
|
|
|
Hello,
This is because the new row has not been committed in the datatable/datasource which you are using with DataGrid. You can write code in CurrentCellChanged event handler to assure that the changes you made in the datagrid are saved when you leave the cell.
HTH. Cheers.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
i am using C# windows appli,
i want my application to run automatically evry time when the user logs in.
please provide the sollution.
thank you in advance
sunny
|
|
|
|
|
Add path to exe file into Windows menu "Programs\StartUp"
or into registry
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
|
|
|
|
|
using Microsoft.Win32;
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run","MyApp", Application.ExecutablePath);
Was it a cat I saw?
|
|
|
|
|
i am using
commandobj.parameters.add(name,datatype,size).value=value;
to add the parameters to my stored procedures as my procedure takes 15 parameters, i have to write the code for 15 times i want to pass all the parameters at a single streatch is it possible,
if yes how?
sunny
-- modified at 1:37 Friday 7th April, 2006
|
|
|
|
|
commandobj.Parameters.AddRange(new SqlParameter[] { new SqlParameter("aaa", "bbb"), new SqlParameter("ccc", "ddd") });
Was it a cat I saw?
|
|
|
|
|
Hi,
I have treeview which contains parent and child nodes.
Child nodes contains html documents.
if user click on child node then it will display corresponding html document.
up to here it's working fine.
if user clicks continuously on child nodes,it is not displaying corresponding documents.So i want to prevent them to don't click upto whole document loding.
how can i do this ,any one help me out.
thank u
pavana
|
|
|
|
|
Is this a winform application?
|
|
|
|
|
hi,
yes it is winform application
|
|
|
|
|
Hi
I hope you will call a function to load the html document on click of the TreeNode. You might be using Treeview_Afterselect or Treeview_click event. What you can do is You can put this code before calling that function.
this.Cursor =Cursors.WaitCursor ;
trv.Enabled=false;
// You will call the function to load html file here
trv.Enabled=true;
this.Cursor =Cursors.Default ;
Hope this helps
|
|
|
|
|
I am using Directory.GetFiles to get an array of all the files in a directory. As far as that goes all is well. But, I need to know just the name of the files, not the whole path to the file. I was trying to us RegEx to search each file path and remove the path but I don't know how to do so universally as I don't know the exact path of the files all the time. Any ideas would be great.
Thanks in advance!
|
|
|
|