|
Trollslayer wrote: ArrayList is not as efficient as List but I will use it for the output table list since it there will be a number of different table types and as long as they have a large number of common methods it is an easy method of keeping the tables in sequence
If it's just the common methods that you need to access via the array list then you can improve matters by using an interface and having a list of that.
public interface ITable
{
int IntProperty { get; set; }
void RandomMethod();
}
public class TableA : ITable
{
public int IntProperty
{
get;
set;
}
public void RandomMethod()
{
}
}
public class TableB : ITable
{
public int IntProperty
{
get;
set;
}
public string StringProperty
{
get;
set;
}
public void RandomMethod()
{
}
}
List<ITable> tableList = new List<ITable>(100);
tableList.AddRange(new ITable[]{
new TableA(),
new TableB()
});
|
|
|
|
|
Thanks Dave, I will be using common methods a lot of the time but have to allow for unique methods as well - DVB is fine until broadcasters get their hands on it - oh, until various small countries have their own needs and get their hands on it etc.
|
|
|
|
|
The problem with standards is there's so many of them
|
|
|
|
|
hi
i need to to get Bios date from c# in win64 environments.
any explicit idea? thanks
|
|
|
|
|
Why are asking the same question again ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
its the first time that i am asking about Biosd Date in Win64 environmet,
anyhow, please answer if possible. thanks.
|
|
|
|
|
faraz34 wrote: its the first time that i am asking about Biosd Date in Win64 environmet,
Not true, you already asked it once below here!
|
|
|
|
|
|
DateTime.Now should do it.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
DateTime.Now should do. There is not difference between BIOS and your system's date time. Any time you make changes in your system clock, it updates the BIOS date time as well.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Are you trying to get the system date/time clock or are you trying to get the Timestamp or Verison of the BIOS itself?
|
|
|
|
|
Hello dears
when I am making a crystal report After I add a text object from toolbox to report headerI want to write a code that can put a value of a field of a table to text object. Does anybody know how can I do it?
(I do apologize if I have a grammatically error in English language, I don’t know English well)
|
|
|
|
|
this operate excellent for win32 base programms,
but for win64 cant return biosdate. any idea? thanks
using System.Security.Permissions;
using Microsoft.Win32;
private string biosDate()
{
RegistryKey RK = Registry.LocalMachine;
RK = RK.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\");
Object Date = RK.GetValue("SystemBiosDate");
return Date.ToString();
}
|
|
|
|
|
SystemBiosDate key doesn't exist
only two letters away from being an asset
|
|
|
|
|
My Vista system's registry has such a SystemBiosDate entry, type REG_SZ, value 04/21/08, which for sure isn't the current date, however it could be the date the manufacturer (Dell) assembled and loaded my machine.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Probably manufacturer specific. My Windows 7, nor Server 208 boxes doesn't have it.
only two letters away from being an asset
|
|
|
|
|
I am trying to do some events while the mouse button is down.
Here is what I have
private static bool IsKeyDown = false;
private void button1_MouseDown(object sender, MouseEventArgs e) {
IsKeyDown = true;
while (IsKeyDown) {
Winamp.Winamp.VolumeDown();
}
}
private void button1_MouseUp(object sender, MouseEventArgs e) {
IsKeyDown = false;
}
The problem is when it hits the mouse down event It continues to run the while loop and does not hit the mouse up event.
I don't want to use a timer to do this.
I did see some code that I think will work better in my app but I cant seem to get it to work can some one please help.
http://stackoverflow.com/questions/1152525/c-winform-looping-event-on-press-button[^]
private bool mouseDown = false;
private void buttonScrollUp_MouseDown(object sender, MouseEventArgs e)
{
mouseDown = true;
new Thread(() => {
while (mouseDown)
{
Invoke(new MethodInvoker(() => [DO_THE_SCROLLING_HERE));
Thread.Sleep([SET_AUTOREPEAT_TIMEOUT_HERE);
}
})
.Start();
}
private void buttonScrollUp_MouseUp(object sender, MouseEventArgs e)
{
mouseDown = false;
}
|
|
|
|
|
Zap-Man wrote: private static bool IsKeyDown = false;
Confused. Can this variable be changed ever? Correct me if I am wrong...
|
|
|
|
|
yes it changes on the mouse down to true. but the mouse up event never fires because the loop has not finished. but it will change in the mouse up event. if the value never changed then I would have to set it to const or read only. A static variable will change. private means this variable is not accessible from another class. when the form is initialized the variable is set to false. When the mouseDown event is fired then the variable is set to true. This is working. the problem lies in the loop. Because it is in the loop the MouseUp event never executes.
|
|
|
|
|
Zap-Man wrote: IsKeyDown = true;
while (IsKeyDown) {
Winamp.Winamp.VolumeDown();
}
This loop will never terminate so your event handler button1_MouseDown will never notify the framework that it is complete. This blocks your application from doing anything else, so you need to separate the functions somehow.
BTW it helps if you put <pre></pre> tags around your code snippet so it is easier to read.
|
|
|
|
|
Hi,
this is all wrong.
1. event handlers get executed on the main thread (aka GUI thread), hence MouseUp cannot do anything as long as MouseDown is active.
2. Your while loop will never exit.
3. Your while loop has no delay, so at what rate will VolumeDown be called?
4. Using Thread.Sleep would not be a good approach as that blocks the GUI; using a timer (a Windows.Forms.Timer) is the perfect solution: start the timer on MouseDown, stop it on MouseUp (or better yet have the Tick handler check Control.MouseButtons).
Zap-Man wrote: I don't want to use a timer
why? because you don't understand them? because you don't like a clean and natural solution?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Look I am not looking for Critics. If you cant help then don't bother posting. I understand timers perfectly. My app has a timer which runs a massive about of code. I understand what the program is doing. I am looking for a way around it.
|
|
|
|
|
This response is uncalled for, Luc's comments are valid.
only two letters away from being an asset
|
|
|
|
|
private AutoResetEvent autoEvent = null;
private void OnMouseDown(object sender, MouseEventArgs e)
{
autoEvent = new AutoResetEvent(false);
ThreadPool.QueueUserWorkItem(VolumeDown);
}
private void OnMouseUp(object sender, MouseEventArgs e)
{
autoEvent.Set();
}
private void VolumeDown(object state)
{
bool lowerVolume = true;
do
{
BeginInvoke(new MethodInvoker(delegate() { Winamp.Winamp.VolumeDown(); }), null);
if(autoEvent.WaitOne(100))
lowerVolume = false;
}
while(lowerVolume);
}
only two letters away from being an asset
|
|
|
|
|
Thank you Mark This is excatly what Im looking for. Congrats to you!!!
|
|
|
|