|
I told you in the previous post
You need to write this code in Timer Tick event handler
Not in Command Click event after you set the properties
private void timer1_Tick(object sender, System.EventArgs e)
{
ArrayList frames = this.gCont.GetResponseFrames();
foreach(byte[] frame in frames)
{
}
}
}
MCAD
|
|
|
|
|
I am assuming you are writing a Windows App.
Basically you click on the timer in the Toolbox panel (in design view) and drag it to the form. Go to timer properties an set Enabled to True and Interval to 1000ms (1s). Double click on the timer icon in design view, This will then switch to your code and it will have added the following:
private void timer1_Tick(object sender, System.EventArgs e)
{
// forech loop and associated code to go here
}
Put your code inside the method and it will run ever second
|
|
|
|
|
I'd like to write a program that has no UI at the current time, but I might like to add one in later. What would be the best type of project to use for this? Should I start a console app, a windows forms app (and just remove the form), should I start a class library app or just an empty one and add as I see fit?
Thanks for the help
- Aaron
|
|
|
|
|
I would start with a Class Library.
www.lovethosetrains.com
|
|
|
|
|
You need to ask your self what is the tasks of your Application and how you will be using your application
As above replay said class library is good start .
You may Create windows service that will run in background
MCAD
|
|
|
|
|
|
Hello All,
I'm looking for recommendations on commercial-grade spell check components, and was hoping you might have some good advice. So far I've seen ComponentOne, RapidSpell, and Aspose, so I was wondering if there was a general preference for one of these three, or perhaps another one that I haven't discovered yet.
Advice, comments & recommendations will be much appreciated.
Thanks in advance!
evan stone | software developer
------------------------------------------
santa rosa, ca, usa
|
|
|
|
|
Hello gurus,
Can one of you give me the regular expression formula in .NET format for the Regex class for detecting if a string is:
- a C variable name
- a path to a file name (ie C:\toto.c)
The goal is to detect if a given string is a C variable and another one is a correct path to a file.
Thanks.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
I created an application that creates a text file as output. After the file is created I would like to give the user the option of opening the file using their default text editor (usually notepad.exe, but not always). How can I find out and use the Windows default text editor (the one associated with *.txt files) Thanks.
www.lovethosetrains.com
|
|
|
|
|
I'm not sure if Process.Start can do this, but ShellExecute ( via pInvoke ) definately can.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't get it, anyway, .Net has already included the RichTextBox component to its library, why don't use it. I don't like using external programs (as much as possible)especially if I can create my own.
Anyway that me
|
|
|
|
|
Process.Start(fileName); Will do it
MCAD
|
|
|
|
|
Thanks all for you help. I used the Process.Start and passed in my textfile.
I didn't use a RichTextBox because I didn't need/want to code the addtional functionality to print/preview etc. This application is also written as a DLL so that later it can be incorporated as a webservice. In addition where I work people have changed the application associated with *.txt to an editor that they prefer.
Thanks again. I didn't realize that I could use Process.Start and just pass in a filename and let Windows handle the rest.
www.lovethosetrains.com
|
|
|
|
|
Hi, I've been working with Windows Forms and I used background images for my buttons. But they appear with a border around the image (the border of the button). It looks very ugly this way. How can I clear it? Is it possible?
|
|
|
|
|
Do you tried to set FlatStyle to Flat
any way Codeproject have nice set of Buttons look for them here
Button Controls
[^]
MCAD
|
|
|
|
|
Hello,
I have a datagrid with 4 rows and 4 colums. the data displays well. I could display sum and average for each row. But i want to display sum for each column in the footer of the datagrid. I know that i can do it with Compute or OnItemDataBound. Using either of this I can display the sum in a particular column. But what i want is sum to be displayed for each column. In the above datagrid i should display for colum1, column2, column3, and column4 separately in the footer.
Can anybodoy help me?
Regards,
Srinivas
|
|
|
|
|
Hi.
My friend and I are very new to C#, we would like to start a project in C# together.
We have Team foundation server 2005 beta2 from microsoft, but can't install it because of known issues.
Until the final is released, we decided to continue without it.
We created a ASP.Net webpage where he edits the frontend (site.aspx) and backend (site.aspx.cs) while i have added a new page to the project called newstuff.cs (in a subfolder called App_code)
If i make a method called CalculateDistance(), how do i include it in the main project page (site.aspx.cs) ?
I have some code like this:
<br />
using System.Net;<br />
using System.Runtime.InteropServices;<br />
[DllImport("iphlpapi.dll", ExactSpelling = true)]<br />
public static extern int SendARP(int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen);<br />
<br />
String LocalHostName = Dns.GetHostName();<br />
string[] Ipaddr = new string[3];<br />
Ipaddr[0] = LocalHostName;<br />
System.Net.IPHostEntry LocalIpAddress = Dns.GetHostEntry(LocalHostName);<br />
System.Net.IPAddress[] FirstAddress = LocalIpAddress.AddressList;<br />
foreach (IPAddress TempA in FirstAddress)<br />
{<br />
Ipaddr[1] = TempA.ToString();<br />
byte[] ab = new byte[6];<br />
int len = ab.Length;<br />
int r = SendARP((int)TempA.Address, 0, ab, ref len);<br />
Ipaddr[2] = BitConverter.ToString(ab, 0, 6);<br />
}<br />
How do i "convert" that to a method and return the value if Ipaddr[2] correctly ?
like this?:
public arp()<br />
{<br />
<br />
=code=<br />
<br />
return Ipaddr[2];<br />
}
and how do i access the method in the main project file (site.aspx.cs) ?
I'm sorry to ask so many questions and answer partally on some of them.
|
|
|
|
|
using System.Net;
using System.Runtime.InteropServices;
class Arp
{
[DllImport("iphlpapi.dll", ExactSpelling = true)]
private static extern int SendARP(int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen);
public string MyMethodName()
{
string LocalHostName = Dns.GetHostName();
string[] Ipaddr = new string[3];
Ipaddr[0] = LocalHostName;
System.Net.IPHostEntry LocalIpAddress = Dns.GetHostEntry(LocalHostName);
System.Net.IPAddress[] FirstAddress = LocalIpAddress.AddressList;
foreach (IPAddress TempA in FirstAddress)
{
Ipaddr[1] = TempA.ToString();
byte[] ab = new byte[6];
int len = ab.Length;
int r = SendARP((int)TempA.Address, 0, ab, ref len);
Ipaddr[2] = BitConverter.ToString(ab, 0, 6);
}
}
}
To call this from some other code you first create an instance of Arp then you call the MyMethodName() method (you'll want to change this to a more suitable name)
Does this help?
By the way, given the price tag of Team system I doubt that you and a friend will want to use it once it is out of beta. It seems to be gears towards teams of 20+ (even although MS say 5+)
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
We Are under education in Denmark and have an aggreement with MS Academic.
We can download every Microsoft product with valid license as long we are under education.
We just want to taste team programming, so that we are prepared when we finish the education.
And yes, it confirmed my guesses. thanks for the help.
I have another problem now:
Error 2 'Arp.CollectList()': not all code paths return a value
This is the code:
using System;<br />
using System.Runtime.InteropServices;<br />
using System.Net;<br />
<br />
public class Arp<br />
{<br />
[DllImport("iphlpapi.dll", ExactSpelling = true)]<br />
public static extern int SendARP(<br />
int DestIP,<br />
int SrcIP,<br />
[Out] byte[] pMacAddr,<br />
ref int PhyAddrLen);<br />
public string CollectList()<br />
{<br />
for (int i = 20; i < 70; i++)<br />
{<br />
String sStatus;<br />
String IPString = "192.168.0." + i;<br />
string[] _splitString = IPString.Split(new char[] { '.' });<br />
<br />
int _retVal = 0;<br />
_retVal += (int)(int.Parse(_splitString[3]) * Math.Pow(256, 0));<br />
_retVal += (int)(int.Parse(_splitString[2]) * Math.Pow(256, 1));<br />
_retVal += (int)(int.Parse(_splitString[1]) * Math.Pow(256, 2));<br />
_retVal += (int)(int.Parse(_splitString[0]) * Math.Pow(256, 3));<br />
_retVal = (int)(((_retVal & 0x000000ff) << 24) +<br />
((_retVal & 0x0000ff00) << 8) +<br />
((_retVal & 0x00ff0000) >> 8) +<br />
((_retVal & 0xff000000) >> 24));<br />
<br />
byte[] ab = new byte[6];<br />
int len = ab.Length;<br />
int r = SendARP((int)_retVal, 0, ab, ref len);<br />
string sMac = BitConverter.ToString(ab, 0, 6);<br />
<br />
if (sMac == "00-00-00-00-00-00")<br />
{<br />
sStatus = "<font color = red>Offline</font>";<br />
}<br />
else<br />
{<br />
sStatus = "<font color = green>Online</font>";<br />
}<br />
<br />
}<br />
}<br />
}
|
|
|
|
|
Public string CollectList() <- It does not return a value, so i removed string and inserted void.
So now it's Public void CollectList()
|
|
|
|
|
I have a DataGrid Bounded to a DataTable. I need a way to disable auto-sorting while editing and tabbing out on a sorted column. The DataGrid should get sorted only on Column Click.
Is there a clean way to achieve this?
Live Life King Size
Alomgir Miah
|
|
|
|
|
Dear all
I have a tab control that contains 5 pages. I want to disable the last 4 pages untill I finish from the first one, then I enable the second one untile I finish it and so on.
But, How to do it????
I searched in the properties but did not find anything, is there a programmatic solution.
waitting..........
thanks
|
|
|
|
|
|
Hello
After attaching onchange event for select element I have to double-click on the select boxes to get them to show their <options>.
This is the code for event attachment:
((mshtml.HTMLSelectElementEvents2_Event)oSelect).onchange += new mshtml.HTMLSelectElementEvents2_onchangeEventHandler(this.Select_onchange)
What I'm doing wrong?
Denis
|
|
|
|
|
in an ASP.NET Web application, in the login page,wehn the user enters his username and password,i need to compare the entered username and password with the ones present in the database table. im using c# and sql server2000
plz help
|
|
|
|