|
Hi , pls can you tell me & explain to me what is difference between the two Objects ?
Thank you
try to be good if you can't be the best
|
|
|
|
|
Read up on the two in the MSDN... there is a whole wealth of knowledge on there
Cheers
|
|
|
|
|
Hi
Im writing a neat little app to fetch raw text content from a website.
However, the website im trying to get data from first sends me to a "bandwidth test site", then redirects me to the site i want data from. How can i handle this in c#?
Code so far;
<br />
String url = "http://www1.nrk.no/nett-tv/bokstav/@";<br />
String content = ""; <br />
HttpWebRequest request=(HttpWebRequest)WebRequest.Create(url); <br />
request.AllowAutoRedirect=true;<br />
request.MaximumAutomaticRedirections=200;<br />
HttpWebResponse request = (HttpWebResponse)myHttpWebRequest.GetResponse(); <br />
<br />
Stream receiveStream = request.GetResponseStream();<br />
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");<br />
<br />
StreamReader readStream = new StreamReader( receiveStream, encode );<br />
content = readStream.ReadToEnd();<br />
<br />
textBox1.Text=content;
This only gets the inital page...so, how to get the redirect page?
madsun
|
|
|
|
|
please help me. how do i simulate a key/key combination press. let's say when an event is trigerred, i want the form to act like i presse the escape key, or alt+f4!
rzvme
|
|
|
|
|
|
i had a look at the cide in the web site and i think i got it but i dont understand 2 things:
1) the alt key isn't in your enum VK
2) your call to the send input method (NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput)); NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput)); etc.) where is the alt key or print screen key in your function call? What would change in the code if , for example, i would want to pres ctrl+g instead of alt+print screen
cheers!
rzvme
|
|
|
|
|
i added a few code lines to press enter before and escape after pressing ctrl+g .right now my code looks like this. The ctrl+g part of the code works fine, but the rest doesn't work at all. what's wrong?
// to press enter
structInput.ki.wVk = (ushort)NativeWIN32.VK.RETURN;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
// Key up the actual key-code
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)NativeWIN32.VK.RETURN;//vk;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
//Press control Key
structInput.ki.wVk = (ushort)NativeWIN32.VK.CONTROL;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
// Key down the actual key-code
structInput.ki.wVk = (ushort)NativeWIN32.VK.G;//vk;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
// Key up the actual key-code
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)NativeWIN32.VK.G;//vk;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
//Keyup control
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)NativeWIN32.VK.CONTROL;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
// to press escape
structInput.ki.wVk = (ushort)NativeWIN32.VK.ESCAPE;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
// Key up the actual key-code
structInput.ki.dwFlags = NativeWIN32.KEYEVENTF_KEYUP;
structInput.ki.wVk = (ushort)NativeWIN32.VK.ESCAPE;//vk;
intReturn = NativeWIN32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
rzvme
|
|
|
|
|
hi
i am use .net 2.0 (vs2005)
i was add printdocument to my form and add printpreviewdialog also and set printpreviewdialog.document to printdocument, but when i compile my app printpreview dialog appear but nothing exist in it (it's empty)..
i have a datagridview in my form with many records .. i want to print datagridview records ..
how to do that and if i want to print multipage how to do ??
thanks ..
|
|
|
|
|
in order to print you need to draw using the graphic object of the eventargs on the onPrint event.
If you're looking for an easy way, you can check out for printablelistview in the site. this listview contains a print() method that prints a listview.
if you'de like to print a form you can check out:
http://www.codeproject.com/dotnet/PrintingFormReport.asp[^]
for printing forms.
hope it helps.
|
|
|
|
|
OK, so I'm working on a little app, and I read about this new settings stuff, so I thought I'd give it a go. I've added a lot of stuff to a settings file and generated a class to read/write it, it looks something like this:
public class UserSettings : ApplicationSettingsBase
{
[UserScopedSetting()]
[DefaultSettingValue("1")]
public double SlideshowSpeed
{
get
{
return (double)(this["SlideshowSpeed"]);
}
set
{
this["SlideshowSpeed"] = value;
}
}
// etc
The help is useless, it seems to mostly be VB only. However, while this seems to work, it always returns the defaults. The properties in the app.config are matching the names in my class, as you can see. I have tried making them ApplicationScoped, as I realise I don't have a user named config file, nor do I see where to find one.
Then I read that Properties.Settings should give me a strongly typed collection of the items in my settings file. No, that plain does NOT work, in any way shape or form, despite all the examples on the web that indicate it should.
Is this stuff broken, or just really poorly documented ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I tried using the Settings classes autogenerated by the IDE and it worked fine. I found that the changed settings are not reflected in the exe.config file, instead, it's stored in the user's profile directory (C:\Documents and Settings\<UserName>\Local Settings\Application Data\....\WindowsApplication1.exe_Url_ivvf3kg5nf2omiqzptjeklawxynwvil5\1.0.0.0\user.config). The code I used to read and modify the values is pretty plain
MessageBox.Show(Properties.Settings.Default.TestSetting);
Properties.Settings.Default.TestSetting = "ItWorks";
Properties.Settings.Default.Save(); Hope this helps.
|
|
|
|
|
OK - how did you get that far ? I've added settings and they are NOT available to by via that sort of code, that's exactly what I tried.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Nothing special, I created a new WinForms project, double clicked Settings.settings on Solution Explorer, added my custom setting (TestSetting ). Built the project and that was it, I got Intellisense recognizing the TestSetting property on Properties.Settings.Default . FWIW, I'm using the Express Edition, not VS .NET 2005.
|
|
|
|
|
How do i record the sound from the microphone?
Any links or code will be appreciated.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hey Everybody!
I'm trying to send a file through a network using TCP client.
for small files I had no problem, but when I got to bigger files I had to find a solution to the buffer problem.
To do that I "cut" the file into chunks, and sending each time a chunk at size 65000. now, everything is going well and the file does go through, but the problem is that the file gets to the other computer corrupted. The file size on the two computers is identical, but its still corrupted.
any ideas anyone????
Thanks!
|
|
|
|
|
If you have writen seperate sender and receiver, there may be some difference in sending and receving variable data type I mean the size may differ.
Mujtaba
|
|
|
|
|
TCP does not preserve message boundaries. You must pay attention to the return value of GetStream().Read - this will tell you how much data was returned in a particular call. The remaining bytes in the buffer passed to Read will have the same value as they had before the call was made.
Remember that network streams deal in bytes. If you're sending a text file and reading it as text into string variables, ensure that you use the same Encoding on both ends to convert to and from byte[] buffers.
|
|
|
|
|
Could please someone tell me what are the pre requsites for a C++ dll to be used in C#. I am having problem in using C++ dll in my C# code.
Mujtaba
|
|
|
|
|
It needs to export something, either as a normal dll, or through COM or .NET. Perhaps if you gave us some details ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I want to use a normal dll that contains a simple class and I want to create an object of that class in my C# code.
Mujtaba
|
|
|
|
|
I'm not sure if you can do that, because I don't believe you can use p/invoke to export a class from a C++ dll.
Why don't you want to use managed C++ ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am not having detailed concept of that but now I am starting managed C++. Could you give me any links about it?
Mujtaba
|
|
|
|
|
Nish has written heaps of articles about it, and has a blog as well, I'd read those.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
OK Thanx very much.
So nice of you.
Mujtaba
|
|
|
|
|
Hi,
How do you add a new line to a textbox like in the following:-
<br />
textBoxMemberNotes.Text = File.ReadAllText(filename) &CrLf +now;<br />
Glen Harvy
|
|
|
|