|
BobInNJ wrote: it does not.
This does not make any sense to me. Is there a reason for it?
A struct in C++ and C# is different. In C++, struct is used to represent PODs and in C# it is used for representing value types. In .NET, most of the objects will be allocated on the managed heap. But struct has got a possibility of getting allocated on the stack and CLR can't guarantee to zero out the locations each filed uses. If parameterless constructor is allowed, there will be problems in array allocation as well.
So it enforces all fields to be initialized and provide a default constructor that does this. This helps compiler to copy the values without worrying about uninitialized fields.
Best wishes,
Navaneeth
|
|
|
|
|
Navaneeth,
Thanks for the response. However, I am not familiar with the term POD. What does it mean?
Bob
|
|
|
|
|
POD - Plain Old Datastructure.
Best wishes,
Navaneeth
|
|
|
|
|
BobInNJ wrote: I am in the process of learning C sharp. Background is in C++ with some Java.
The answer to your question is very well described in DotNet Zero[^] by Charles Petzold. I came from a similar background and found this document a great starting point.
|
|
|
|
|
Yeah, what they said.
But I hope you usually use an enumeration for month names and such.
|
|
|
|
|
Good comment and thanks for the response. I believe what you are telling me is that
when converting an enum value to a string, I should not use an array like:
private string[] strArray = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
but I should use the built in method ToString. While, I believe you are right, that means
that the identifier for the enum must be the same as the string I want to print. My current
enumeration is the following:
enum Month {<br />
eJan, eFeb, eMar, eApr, eMay, eJun,<br />
eJul, eAug, eSep, eOct, eNov, eDec<br />
};
Since, I want the string to be January, not eJan, I would need to change my enum values. Do I have the right? or is there something else I am missing.
Bob
|
|
|
|
|
Warts?! You need to join the new millenium.
Anyway, you can apply a System.ComponentModel.DescriptionAttribute to your enumerated values and then use Reflection to retrieve them.
May I suggsest my EnumTransmogrifier[^] as a convenient way to work with alternative texts for enumerationed values?
|
|
|
|
|
Hello,
i have one ore more XPort's (Webserver to RS232) which connect to the Ethernet via DHCP. Now my windows program has to find the IP-Addresses of this devices. I can distinguish between a normal computer and a xport by checking the MAC address area of the found device.
At the moment I am getting the IP's of the devices by checking the network adaptor address of the computer my software is running on. Then I perform a ping from 1 to 255. After this I read the arp-table to find the devices. This program works, but on the one Hand it is not very smart to ping all the addresses in the Network, on the other hand it takes very long (several Minutes) to ping through all adresses. And if you have 2 ore more networks you have to look up all of them.
Is there any other smart method in c# to solve my problem?
Thanx
Andi
|
|
|
|
|
You don't connect to Ethernet via DHCP. Ethernet is just a cabling and signalling specification. DHCP assigns IP Addresses via TCP/IP.
How you do this depends on the device. Normally, something like this would be done by one of three methods. Again, this what you do depends ENTIRELY on the devices discovery capabilities. So, you've going to have to contact the manufacturer of it or read the documentation on it or both.
1) The device may advertise its existance somehow. Usually, this is done by the device broadcasting a crafted SAP (Service Advertising Protocol) packet or some other custom packet for similar functionality, at some time interval. Your software would be listening on the networks broadcast address for these packets and interpreting the data inside to ID the device and its IP Address.
2) Your software might have to broadcast a crafted "ping" or "hello?" packet that the device listens for and, if/when it hears it, it will respond with some kind of "I'm here!" packet that your software has to listen for.
3) You have to scan the network by pinging or sending some kind of crafted packet to each IP address in the subnet or some other IP range. NO, JUST PINGING 1 TO 255 DOES NOT COVER THE ENTIRE RANGE OF THE SUBNET YOUR MACHINE IS ON! It takes considerabily more math than just assuming your on a non-subnetted class C network and ping that little range.
Does C# or the .NET Framework offer some easy method to do this for you?? No.
|
|
|
|
|
Infect I m developing a software for Mobile shop inventory system & in that I also wants to implement some code for barcode reading from barcode reader machine. so can anyone help me in this regards then please put the code & its procedure that where to implement those lines of code in my software implementation. or if any one already keeps such a costomer inventory software for mobile shope including barcode reader option then please send me its source files + executabel files.
So please please please help me quickly... waiting 4 your quick response...
|
|
|
|
|
Arslan Khan wrote: Infect I m developing a software for Mobile shop inventory system & in that I also wants to implement some code for barcode reading from barcode reader machine. so can anyone help me in this regards then please put the code & its procedure that where to implement those lines of code in my software implementation. or if any one already keeps such a costomer inventory software for mobile shope including barcode reader option then please send me its source files + executabel files.
So please please please help me quickly... waiting 4 your quick response...
Let me see if I've got this straight:
1) You are developing an inventory system for a shop.
2) You want us to tell you, with examples, exactly how to do it, down to where in your code to put what.
3) You also want us to send you the source code and executable for the application.
So two questions before I can do that:
1) You are getting paid for this?
2) How much will you pay me to provide it?
Because hell will freeze over before I do your job for you!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
dear if you can help me then please help me without recieving any pay from me coz b4 taking order for that software I thougt to observe that m I can do that while including barcode reader so the main problem is barcode reader application implement in that software. so please help me if you can...
thanks & with best regards
|
|
|
|
|
Arslan Khan wrote: dear if you can help me then please help me without recieving any pay from me coz b4 taking order for that software I thougt to observe that m I can do that while including barcode reader so the main problem is barcode reader application implement in that software. so please help me if you can...
You mean you have taken the job under false pretenses and you want us to bail you out so you can get paid?
What have you been doing in the ten months since you joined here? Trying to get "Hello World" to work?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
If you are not prepared to pay for someone to do development work how can you expect anyone to pay you.
If you don't know how to do the job then don't take it, or sub contract to someone who can.
As to barcode reader software, and free source code, why ask when Google could have given you the answer hours ago. Google for c# barcode reader[^].
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hi,i'd like to share my experience with you.Here are some steps about how to implement barcode reader in c#.net:
1. Install .NET Barcode Reader component to your Visual C# .NET project.Add a BarcodeScanner.dll to C# project reference
2. Scan & read linear barcodes in C# class?
string[] barcodes = BarcodeScanner.Scan("code128-image.gif", BarcodeType.Code128);
3. To improve the reading speed, call ScanSingleBarcode, if there is maximum one barcode per image.
string[] barcodes = BarcodeScanner.ScanSingleBarcode("code39-image.gif", BarcodeType.Code39);
4. To scan defined areas in the image in C#
List<SRegion> areas = new List<SRegion>();
SRegion area = new SRegion(0, 0, 50, 60);
areas.Add(area);
string[] barcodes = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas);
5. To scan and get more information about the barcode in C#
BarcodeDetail[] barcodeDetails = BarcodeScanner.ScanInDetails("code39image.gif", BarcodeType.Code39);
This is my experience of reading barcode using c#,i hope i can help you more or less.If you have any question,we can make a discussion here.
|
|
|
|
|
I am creating an Event log using the EventLog.WriteEntry and I want to know how can I get the written log identity the allow the user to open the windows event viewer displaying that event?
|
|
|
|
|
EventLog log = new EventLog("logName");
log.WriteEntry("Message");
EventLogEntry myEntry = log.Entries[log.Entries.Count - 1]
writing to a specific log will enable you to then get the last entry in the log which hopefully will be yours as long as nothing else wrote to that log in that millisecond.
I don't see any unique identifier for the entry on the EventLogEntry class though. But it is certainly where I would start. Maybe some of the available properties together will give you what you want.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
I am using this <a href="http://code.msdn.microsoft.com/TaskDialogforWinForm#">TaskDialog</a> and I want to know if it's possible to use iot but with no buttons!!
Actually I want to use it with a text and progress bar only to be as a please wait dialog!
is it possible?
|
|
|
|
|
The Vista Task Dialog does what it does, and is not .Net code so you can't change it. You appear to want a form simple with a progress bar. A bit different. I suggest you just code your own. A lot easier. However coding a progress indicator involves a fair bit of threading knowledge. The difficult part is not the form.
As a side note, I would never want to code specifically against a Vista Control for one simple reason. Then I would be tied to Vista! I wouldn't want to use Vista in the first place, and with Windows 7 now released it seems silly to tie your code to a platform that is being replaced.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hi would anyone be able to advise me on how to create a discussion forum in c# using Visual Studio 2008. So far I have connected to by SQL server express database but I don't know how to go on from here...
|
|
|
|
|
From creating a connection to SQL to creating a discussion forum is a big leap.
Check out http://www.yetanotherforum.net/[^] for some ideas in that direction.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hey - at least he had done the hard bit!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
I have downloaded the TaskDialog from MSDN Code Gallery and it's working find on my development machine (Vista and VS 2008 installed) but when i deployed to the first machine (XP) and copied DLL in the application EXE folder (INSTALLDIR) then I got this error:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.EntryPointNotFoundException: Unable to find an entry point named 'TaskDialogIndirect' in DLL 'ComCtl32'.
at Microsoft.Samples.UnsafeNativeMethods.TaskDialogIndirect(TASKDIALOGCONFIG& pTaskConfig, Int32& pnButton, Int32& pnRadioButton, Boolean& pfVerificationFlagChecked)
at Microsoft.Samples.TaskDialog.PrivateShow(IntPtr hwndOwner, Boolean& verificationFlagChecked, Int32& radioButtonResult)
at Microsoft.Samples.TaskDialog.Show(IntPtr hwndOwner, Boolean& verificationFlagChecked, Int32& radioButtonResult)
at Microsoft.Samples.TaskDialog.Show()
at The_Internet_Cafe_System.frmMain.frmMain_FormClosing(Object sender, FormClosingEventArgs e)
at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
at System.Windows.Forms.Form.WmClose(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
tics
Assembly Version: 1.0.0.0
Win32 Version: 1.00.0.0
CodeBase: file:----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
TaskDialog
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
DevExpress.XtraNavBar.v7.2
Assembly Version: 7.2.2.0
Win32 Version: 7.2.2.0
CodeBase: file:----------------------------------------
DevExpress.XtraEditors.v7.2
Assembly Version: 7.2.2.0
Win32 Version: 7.2.2.0
CodeBase: file:----------------------------------------
DevExpress.Data.v7.2
Assembly Version: 7.2.2.0
Win32 Version: 7.2.2.0
CodeBase: file:----------------------------------------
DevExpress.Utils.v7.2
Assembly Version: 7.2.2.0
Win32 Version: 7.2.2.0
CodeBase: file:----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
|
|
|
|
|
the page you linked to calls it "Vista's Task Dialog"; why should this work on older systems?
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
but then it should have at least show it i normal style!!
I didn't expect it to throw and error!!
|
|
|
|