|
My Project:
http://rapidshare.com/files/388966495/bandwidth_meter.rar.html[^]
This program is working but my LCD doesnt show anything. By the way LCD is working a normal condition. I am waiting for your advice. Thank you...
public partial class MainForm : Form
{
private const double timerUpdate = 1000;
private NetworkInterface[] nicArr;
private System.Windows.Forms.Timer timer;
public MainForm()
{
InitializeComponent();
InitializeNetworkInterface();
InitializeTimer();
}
public int data = 888;
public int control = 890;
private void InitializeNetworkInterface()
{
nicArr = NetworkInterface.GetAllNetworkInterfaces();
for (int i = 0; i < nicArr.Length; i++)
cmbInterface.Items.Add(nicArr[i].Name);
cmbInterface.SelectedIndex = 0;
}
private void InitializeTimer()
{
timer = new System.Windows.Forms.Timer();
timer.Interval = (int)timerUpdate;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
private void UpdateNetworkInterface()
{
string title, duration;
NetworkInterface nic = nicArr[cmbInterface.SelectedIndex];
IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics();
int bytesSentSpeed = (int)(interfaceStats.BytesSent - double.Parse(lblBytesSent.Text)) / 1024;
int bytesReceivedSpeed = (int)(interfaceStats.BytesReceived - double.Parse(lblBytesReceived.Text)) / 1024;
lblSpeed.Text = nic.Speed.ToString();
lblInterfaceType.Text = nic.NetworkInterfaceType.ToString();
lblSpeed.Text = nic.Speed.ToString();
lblBytesReceived.Text = interfaceStats.BytesReceived.ToString();
lblBytesSent.Text = interfaceStats.BytesSent.ToString();
lblUpload.Text = bytesSentSpeed.ToString() + " KB/s";
lblDownload.Text = bytesReceivedSpeed.ToString() + " KB/s";
title = lblDownload.Text;
duration = lblUpload.Text;
writetoLCD(title, duration);
}
void timer_Tick(object sender, EventArgs e)
{
UpdateNetworkInterface();
}
private void writetoLCD(string title, string duration)
{
PortAccess.Output(data, 1);
PortAccess.Output(control, 8); Thread.Sleep(1);
PortAccess.Output(control, 9); Thread.Sleep(1);
int a;
char[] line1_ch_buffer, line2_ch_buffer;
string line1_st_buffer, line2_st_buffer;
line1_st_buffer = title;
line1_ch_buffer = line1_st_buffer.ToCharArray();
line2_st_buffer = duration;
line2_ch_buffer = line2_st_buffer.ToCharArray();
HangiSatir(1, 1);
for (a = 0; a < line1_ch_buffer.Length; a++)
{
PortAccess.Output(control, 4); Thread.Sleep(1);
PortAccess.Output(data, (int)line1_ch_buffer[a]);
PortAccess.Output(control, 5); Thread.Sleep(1);
}
HangiSatir(2, line1_ch_buffer.Length);
for (a = 0; a < line2_ch_buffer.Length; a++)
{
PortAccess.Output(control, 5); Thread.Sleep(1);
PortAccess.Output(control, 4); Thread.Sleep(1);
PortAccess.Output(data, (int)line2_ch_buffer[a]);
PortAccess.Output(control, 5); Thread.Sleep(1);
}
}
private void HangiSatir(int line, int column)
{
PortAccess.Output(control, 8);
if (line == 1)
PortAccess.Output(data, 127 + column);
if (line == 2)
{
int sayi = 39 - column;
for (int i = 0; i <= sayi; i++)
{
PortAccess.Output(control, 4); Thread.Sleep(1);
PortAccess.Output(data, 16);
PortAccess.Output(control, 5); Thread.Sleep(1);
}
}
}
public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
public static extern int Input(int adress);
Please help me. Thank you for your answers
modified on Tuesday, May 18, 2010 9:48 PM
|
|
|
|
|
THeKiNG20 wrote: I am waiting for your advice
My advice is ask properly to get an answer.
|
|
|
|
|
my english is not very good. I am sorry
|
|
|
|
|
Probably nobody is going to download your code and investigate it; if you want any help here, it is your task to explain properly and show the relevant code snippet (inside PRE tags!).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
OK. I see you. Thank you
|
|
|
|
|
|
Hello,
I've got some shared mailboxes in AD. They are inside an OU. An example name could be: CN=Mailbox1, OU=Spain;
I'm getting properties of these mailboxes via C#.
I've searched and searched but i'm not able to list the users in the Security tab.
I'm able to get all the OU users. From these users i can get the members, the owner...
But i'm not able to list the users that are in the Security Tab (When you open one of these mailboxes in AD, you go to the Security Tab, all the users listed in there).
I don't need the permission type (read, write...). I only need to list these users.
I'm unable to find any help.
Thanks and kind regards.
My code is the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.Data;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string OuDn;
OuDn = "OU=Mailboxes,OU=Site,DC=prueba,DC=net";
try
{
DirectoryEntry directoryObject = new DirectoryEntry("LDAP://" + OuDn);
foreach (DirectoryEntry child in directoryObject.Children)
{
Console.WriteLine(child.Name);
child.Close();
child.Dispose();
}
directoryObject.Close();
directoryObject.Dispose();
}
catch (DirectoryServicesCOMException e)
{
Console.WriteLine("An Error Occurred: " + e.Message.ToString());
}
Console.ReadLine();
}
}
}
|
|
|
|
|
I have a VB.Net Windows Application that opens IE7. I've been asked to open IE7 without menus or an address bar. I can't figure out how to do this. Also, it's a tiny app so I could easily rewrite it in C# if it's easier to accomplish this in C#.
Thanks!
|
|
|
|
|
Its called kiosk mode and you can use the -k commandline switch
C:\Program Files\Internet Explorer\iexplore.exe -k
Melanie Peterson wrote: I could easily rewrite it in C# if it's easier
Rewrite in C# anyway
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes, thanks, I know about kiosk mode. I don't want to use kiosk mode because it would be hard for my users to deal with, closing it, etc. They'd freak. I'm looking for another way to open IE, but maintain the minimize, size, and close controls at the very top right.
Thanks anyway!
|
|
|
|
|
Guess it helps to be a little more specific about your requirements. The only other way I know of is to use window.open from JavaScript.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi all,
I have a generic question regarding DataGridView. If I have a dataSet with a table, is it best to set the DataSource for the DataGridView as dataSet and the DataMember as the Table in the dataSet?
Or should the DataGridView's DataSource be a bindingSource whose DataSource is the dataSet and whose DataMember is the Table in the dataSet? If so, that seems redundant. However, I'm sure there is a reason for doing it this way.
Thanks.
|
|
|
|
|
It's a horses for courses thing IMO.
For very, very simple things with little or no user interaction it is probably simpler to bind directly to the dataset.
For most other circumstances and in my somewhat limited experience, using a BindingSource gives more control functionality.
Some links for BindingSource:
BindingSource a closer look[^]
BindingSource Class (MSDN)[^]. Just read the Remarks section for reasons that you might want to use a BindingSource.
A Detailed Data Binding Tutorial[^]. Any list would be incomplete without a Code Project article.
Others might disagree and I hope that they offer their opinions.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Message Closed
modified 5-Apr-17 9:25am.
|
|
|
|
|
hi guys
how to disable text box enter keypress sound?
thanks a lot
|
|
|
|
|
Turn off your speakers.
This is a default Windows configuration and would need to be changed by the end user.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
As far as I am aware these sounds are set in the System Settings and apply to all applications. Obviously they can be changed through the Control Panel of the Computer concerned and this[^] article explains how to do it programatically.
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
behzadcp wrote: text box enter keypress sound
What sound is that? Nothing happens when I do that
|
|
|
|
|
I have Visual Studio 2010 Professional and SQL Server Express installed. I am following the MSDN walkthrough for connecting to Data in a SQL Server Express Database (Windows Form).
I have downloaded and installed the Northwind sample.
I opened a new windows form project and then attempted to add a Service-based Database.
An error message comes up:
Failed to generate a user instance of Sql Server due to a failure in starting the process for the user instance. The connection will be closed.
This message comes up everytime I make an effort to connect to SQL in any way. Can anyone help me?
Thanks
Darrall
Also I have a 64 bit OS and that was a bit of a problem in installing the SQL
modified on Tuesday, May 18, 2010 2:29 PM
|
|
|
|
|
|
Thank you!!!! This is the answer I have been looking for for weeks
|
|
|
|
|
See if any of the solutions in this[^] thread on MSDN helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Thanks. See the reply above. That site specifically solved the problem. Your answer is greatly appreciated.
|
|
|
|
|
hello everybody....apart from presenting differences (like No Pointer, No Overloading) from java, i need to present that Why C# is Better than Java. I would be thankful if you provide me 5 to 10 points, just a hint you know.
|
|
|
|
|
1) C Comes before J in the alphabet
2) C# has fewer letters to type than Java
3) Java can be confused with coffee or a South Pacific island
I know the language. I've read a book. - _Madmatt
|
|
|
|