|
Hello,
Steve_Harris wrote: Spot on, many thanks! System.Timers.Timer did the job.
Glad I could help!
Steve_Harris wrote: Stupid .NET....
No comment on that, cause I think I know how you meant it!
All the best,
Martin
|
|
|
|
|
Martin# wrote: No comment on that, cause I think I know how you meant it!
I came to C# from C++ / MFC, and although there are a lot of things to like with it, I still don't understand some of the design decisions. For example, first of all you could only derive a class from a single base class. Then people complained so they tacked on Interfaces to let you do it! Well rather than tack on interfaces, why not just let you do multiple inheritance properly?! And in the case of this Timer, implementing a Windows.Forms timer that blocks in the Windows.Forms thread is just daft.
Ah well, got to live with it!
Steve.
|
|
|
|
|
Steve_Harris wrote: I still don't understand some of the design decisions. For example, first of all you could only derive a class from a single base class. Then people complained so they tacked on Interfaces to let you do it! Well rather than tack on interfaces, why not just let you do multiple inheritance properly?!
That's a good point. But I think a lot of discusion where made because of that!
Steve_Harris wrote: And in the case of this Timer, implementing a Windows.Forms timer that blocks in the Windows.Forms thread is just daft.
Don't think so! Wait untill you have to deal with invoking your UI, whcih is not neccesary with the Forms.Timer.
Steve_Harris wrote: Ah well, got to live with it!
Yep
All the best,
Martin
|
|
|
|
|
Hi,
I could come up with a lot of reasons...
What kind of Timer ?
what other event ?
using threads ?
show us the relevant part of the code !
|
|
|
|
|
I create a project with C# lauguage in structure C/s
I want to save a affix to the oracle database, the affix format is doc txt and others
when I open it in another computer it can not be opened. what is problem?
what can I do?
the code is:
if (tbContent1.Text!="")
{
string FileName=this.tbContent1.Text.ToString().Trim();
FileStream fs=new FileStream(FileName,FileMode.OpenOrCreate,FileAccess.Read);
byte[] MyData=new byte[fs.Length];
fs.Read(MyData,0,(int)fs.Length);
fs.Close();
ds=link.SelectDataBase("select * from BuleAffiB","temptable");
DataRow MyRow=ds.Tables[0].NewRow();
MyRow["affixname"]=FileName;
MyRow["sequeno"]=SequeNo;
MyRow["affcontent"]=MyData;
ds.Tables[0].Rows.Add(MyRow);
ds=link.UpdateDataBase(this.ds,"temptable");
}
string strSQL="insert into NewsB (title,launcher,launchdate,content,mem,sequeno,validdays,validrange,importance) values ('"+CurrentTitle+"','"+CurrentLauncher+"',to_date('"+CurrentDate+"','YYYY-MM-DD HH24:MI:SS'),'"+CurrentContent+"','"+CurrentMem+"','"+SequeNo+"','"+CurrentValidDays+"','"+CurrentValidRange+"','"+Currentimportance+"')";
//insert a record try
{
if (link.ExecuteUpdate(strSQL)>0)
{
MessageBox.Show("succssful!","showMEssage",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
link.Dispose();
|
|
|
|
|
hello in frontend i have 3 buttons one is previous,next,finish ,
and also i have one record(label control).
if clicks on next button i want second record so i want code for this.
iam using vs.net2003 and c#.
srinivas
|
|
|
|
|
Maintain a counter, and increment/decrement the counter for the row.
|
|
|
|
|
the i with static variable
read data from database
in a datatable
and then
datatable[i][0]
|
|
|
|
|
Hi!
I want to get the "Company Name" which is entered by user when windows is being installed, i.e. which can be seen in General tab under "Registered to:" label, when we right click and select My Computer's properties.
I got the local user name through Environment.UserName but cant figure out how to get the "Company Name" of local user...i want to display this information on About dialog box of my application.
Hope i was able to clarify my question, thanks in advance...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
You can get it from the registry
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization"
|
|
|
|
|
F16I,
Thanks alot, it solved my problem...
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
|
Hi all,
How can I convert point to inch or centimetre in C#?
Thanks,
Priyank
|
|
|
|
|
1 Point = 1/72 Inch
|
|
|
|
|
|
Hi,
I know this should be a simple task, but for some odd reason I can't get this to work correct.
I have a MaskedTextBox which is used to take a 5 digit number. My problem is since I made the box a little bigger than the size it would be with 5 digits in it, I want to set the focus to the beginning of the box if the user hasn't entered anything into it yet and clicks on the box to ensure they put in 5 digits.
I set up the event "Enter" with the following code:
if(maskedTB.Text.Length == 0)<br />
{ <br />
maskedTB.Focus();<br />
maskedTB.Select(0,0);<br />
maskedTB.Select();<br />
}
I tried each one of these individually and every combination of the three.
They all just set the focus to be wherever the user selected. So if they select on the area where the 5th digit resides it only allows them to enter 1 number and forces them to hit backspace until they get to the beginning.
Thanks.
|
|
|
|
|
try MaskedTextBox.SelectionStart
|
|
|
|
|
I've also tried to set the selectionStart = 0 to no avail.
|
|
|
|
|
Set the selection start property in the mouse down event of the masked text box. This should solve the issue.
private void maskedTextBox2_MouseDown(object sender, MouseEventArgs e)
{
if (maskedTextBox2.Text.Length == 0)
{
maskedTextBox2.SelectionStart = 0;
}
}
|
|
|
|
|
I have a listbox which is populated at runtime.I want to save the items of listbox in an array.How to save the items of listbox to an array in .Net using C#
|
|
|
|
|
Instead of Array use ArrayList or Dictionary, which is much faster then array.Here is the code snippets for ArrayList.
ArrayList arrList = new ArrayList();
ListBox objList = new ListBox();
//
//Code to store value in array list from Listbox after they are loaded in Listbox.
for (int i = 0; i < objList.Items.Count ; i++)
{
arrList.Add(objList.Items[0]);
}
//
//Code to get value from ArrayList.
for (int i = 0; i < arrList.Count; i++)
{
object objItem = arrList[0];
}
nJoy
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Id agree with Chintan however if it is definately an array you want to use then utilise the list boxes CopyTo property:
listBox1.Items.CopyTo(yourArray, index);
|
|
|
|
|
//Here, select any rows in your Datagrid view by mouse or tab key.
//just replace 'objView' with your data grid view name.
DataGridView objView = new DataGridView();
//This will return currently selected row.
DataGridViewRow row= objView.CurrentRow;
//Now here just specify the ColumnName and assign the updated value.In this case i have updated the column with string "Bill Gates".
row.Cells["ColumnName"].Value = "Bill Gates";
//Hop you understood.
//nJoy
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Hi,
I'm using RKLib Component for exporting data to Excel and it is working perfectly for me. But the drawback of this component is we can export data only to one excel sheet. Anybody have any idea of any component that will export data to excel to multiple worksheets? Any help in this regard would be great. Currently this application is windows. I would like to use the component, if available, in web also.
Thanks in advance
Meeram395
|
|
|
|
|
raja_raman wrote: 'm using RKLib Component
I don't know about that component as i never worked on that
One way is to use COM Objects that will loads the number of Excel sheets you want to load and transfer the data But the drawback of COM objects are bulky and you will have to take care of heap Memory as they will not definetly Garbage Collected .
Antoher way is using Micro of Excel Sheet that is faster and consume low memory
So choose your best option
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|