|
Have just managed....thanks the same...
Cheers
C.N.
|
|
|
|
|
Hi,
I am using StreamReader to read a file. I have to 2 tasks in a function;1st if of reading total lines in the file and 2nd is to do manipulation with the contents of the file.
Now when i read the total lines in the file .. the pointer reaches to the end of file and then when i call second function for manipulation with the contents, it says no line to read.
Is there any method of StreamReader which i could use before calling my second funtion so that i could start reading file from start.
Please help!
Ashu Sharma
Web Analyst
|
|
|
|
|
Hi!
Just set the underlying Stream 's Position property to 0.
mav
|
|
|
|
|
I've created an image in photoshop, with a transparant background, saved it as a tga file, and when I tried to display it in DirectX (2D graphics using Direct3D) there's a white rectangle around the image.
I've used the AlphaBlend flag with the Sprite.Begin function..
How can I make the background transparent?
Should I change something in the code, or in photoshop..?
thanks
|
|
|
|
|
Hi I have written a web service in C#. A web method in this web service returns a response object which contains an attribute with the name "code". For some reason this attribute does not appear in the response.
Response looks like this:
... <transcribeDictationResult>
<status xmlns="http://...">Job Allocated</status>...
If I change the attribute "code" to "codes" or any thing else, the attribute appears in the response:
...<transcribeDictationResult>
<status codes="0" xmlns="http://...">Job Allocated</status> ...
I am really stumped why this is happening. Can anyone give me some insight into this?
Is this because of some keywords or something that .Net uses making their use restricted? But I didn't come across any documentation indicating this.
|
|
|
|
|
How do i find out what is running in the system tray and use that information to clone it? (trying to write my own start bar type application) basically i want to grab everything in the tray, and use that data to produce my own.
|
|
|
|
|
Can anyone tell me:
1. how to interface usb(1.1/2.0)in c#.net.
2. for intercing the usb whether i have to write the driver for that device or use dll
3. how to write driver in c#.net.
thanks in advance
@hs@n
|
|
|
|
|
I've successfully completed a C# project using USB 2.0.
You should look at QuickUSB from Bitwise systems. But not really 'cause it sucks! The other company... um... what is it?... um... CYPRESS is probably better. Bitwise's documentation == cat poop. Also, they have bad coding ethics.
/\ |_ E X E GG
|
|
|
|
|
HI i m new to .Net and doing a project in C# related to Finger Print Recognition. Though at the moment doing research and gathering info abt how to acess Usb Device or Scanner in C# if any of u have some helping matelial plz share it to me thnx
I M new in .net and doing project on Thumb Scaning or" Finger Print Recognition"
|
|
|
|
|
To interact with the device, your going to need to get information on it's API. Maybe there's an SDK available, or else your doing it blindly.
I hope I make sense. Somebody correct me if I'm not.
/\ |_ E X E GG
|
|
|
|
|
You might want to try using Windows Image Acquisition (WIA). It's pretty generic and doesn't give you great deal of control over the image, but it might suit your needs. Search the articles for WIA an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just sent an order for DigitalPersona's SDK and figerprint readers. I expect to get it in about 10 days. It's expensive, but a client of mine is paying for it. I've seen sample code and the docs, and it looks realatively easy to use.
See http://www.digitalpersona.com/[^]
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I'm trying to bind my socket to any local network address and to port 1337 to listen to incomming broadcasts on that port.
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
socket.Bind(new IPEndPoint(IPAddress.Any, 1337));
MSDN says:
"Before calling Bind, you must first create the local IPEndPoint from which you intend to communicate data. If you do not care which local address is assigned, you can create an IPEndPoint using IPAddress.Any as the address parameter, and the underlying service provider will assign the most appropriate network address. This might help simplify your application if you have multiple network interfaces. If you do not care which local port is used, you can create an IPEndPoint using 0 for the port number. In this case, the service provider will assign an available port number between 1024 and 5000.
If you use the above approach, you can discover what local network address and port number has been assigned by calling the LocalEndPoint. If you are using a connection-oriented protocol, LocalEndPoint will not return the locally assigned network address until after you have made a call to the Connect or EndConnect method. If you are using a connectionless protocol, you will not have access to this information until you have completed a send or receive."
IPEndPoint localhost = (IPEndPoint) socket.LocalEndPoint;
Console.WriteLine("LocalEndPoint: {0}", localhost.Address);
Prints: "LocalEndPoint: 0.0.0.0" but by sniffing the NIC (using Ethereal) I can see that packets sent using socket.SendTo(sendBuf, new IPEndPoint(IPAddress.Broadcast, 1337)); originates from the IP 192.168.0.100 (my machine's WLAN NIC). Why isn't this IP address reported by socket.LocalEndPoint ? I need to know the address assigned!
|
|
|
|
|
The thing is, 0.0.0.0 is in fact the endpoint it is assigned to.
0.0.0.0 means "any" and it chooses which actual interface to use at send-time, separately for each packet. So if you are sending to the internet it will use the modem's IP and if to the LAN it'll use the NICs IP.
|
|
|
|
|
I do want to be assigned a network interface to listen for broadcasts. How to do that?
|
|
|
|
|
Well, you should still be able to listen on *all* the interfaces. If you want to assign only a specific one, you will have to find out what interfaces there are beforehand. I don't really know how to do that.
|
|
|
|
|
And pretty frustrating, I am trying to take a screenshot of my c# application, using BitBlt of the whole screen. For some reason the screenshot is taken and saved, but the application window is not part of it.
I tried doing it using Windows Media Encoder, same thing. Even the cursor changes are visible on the video, but the window is simply not there, completely transparent on the video.
Whats going on? Any ideas?
|
|
|
|
|
Answering my own question. Sorry about the vague subject of the orinal message too.
If your .NET form has any transparency key set, BitBlt will ignore the whole form. The window will not be visible to BitBlt.
|
|
|
|
|
Here is a sample program from the MSDN help files:
using System;
using System.Management;
// This example demonstrates reading a property of a ManagementObject.
class Sample_ManagementObject
{
public static int Main(string[] args) {
ManagementObject disk = new ManagementObject(
"win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
return 0;
}
}
It seems simple enough, but when I have tried to build this code I get the following error:
error CS0234: The type or namespace name 'Management' does not exist in the class or namespace 'System' (are you missing an assembly reference?).
I have this same problem in my application and in a test standalone console application that I developed. Does anybody have any idea why I am getting this error? I see that other people are using the Management namespace in other postings, so it seems hard for me to believe that the management namespace is really not a member of the system class.
Any help would be appreciated,
Craig
Craig
|
|
|
|
|
I placed the code into a C# console application and it worked fine. From the error message you are receiving it seems like you did not add the assembly reference. To add this reference open the Solution Explorer window. Right click on the word References in the tree. In the menu that opens up click on Add Reference... In the Add Reference window that come up look for the component name System.Management and click on it to highlight it. Then press the Select button and then the OK button. Now you can recompile and you should be fine.
|
|
|
|
|
Thanks for the help. It works fine now.
Craig
|
|
|
|
|
Now re-read the error message....pretty good i'd say!
error CS0234: The type or namespace name 'Management' does not exist in the class or namespace 'System' (are you missing an assembly reference?).
|
|
|
|
|
I want to use a context menu with a tabcontrol. How can I detect which tab was right clicked?
|
|
|
|
|
In the event handler for the MouseDown events of the TabPages, you can check:
private void tab_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((TabPage)sender == tabPage1 && e.Button == MouseButtons.Right)
}
However, if the purpose of detecting right click on a tab page is to invoke the context menu, then such a detection is not even needed, as the same objective can be achieved without such detection in the following manner.
In the designer, draw a TabControl on you form. Draw the TabPages on this control as per your requirements (say, tabPage1 and tabPage2). Now, draw the context menu's for each TabPage as per requirements (say contextMenu1 and contextmenu2) with the required menu items. Select tabPage1 tab in designer and in its properties window, set the ContextMenu property to the value of contextMenu1 object. Similarly, the ContextMenu property of tabPage2 can be set to contextMenu2 object. Compile and run the program.
Now, when you right-click anywhere inside the area of tabPage1, you'll automatically get contextMenu1. Similarly, right-clicking anywhere in tabPage2 will show the contextMenu2 automatically.
Thus, there is no need for you to detect as to which tab was right-clicked.
|
|
|
|
|
Thanks for your reply. First of all I want to make one thing clear. I'm trying to click the actual tab, not the tabpage. I also want to use the same context menu for different tabs. Otherwise I would have no trouble finding out which tab was right clicked.
I have already tried your first aproach with one difference. I create the tabs dynamicly with the following code (somewhat pseudo):
TabPage tpNew = new TabPage();
tpNew.Text = "Some text";
tpNew.MouseUp += new MouseEventHandler(tpNew_MouseUp);
tcTabControl.TabPages.Add(tpNew);
The eventhandler tpNew_MouseUp is never called.
I can hook up the context menu a number of ways that I am aware of. Even on the TabControl itself, but I have no idea how to find out what tab were right clicked. Is it possible to fins out which of the headers that are under the X and Y coordinates when the mouse was clicked?
|
|
|
|