|
I'm actually using thread to keep on scanning on every time interval but don't you think that's not a good idea?
|
|
|
|
|
Hi,
for a Control (a Form is a Control) you can override WndProc and check for
wParam==WM_DEVICECHANGE
That will give you an event whenever a device (such as a camera, USB memory stick, ...)
gets added or removed.
|
|
|
|
|
Try responding to the WM_DEVICECHANGE[^] window message. A WParam value of DBT_DEVICEARRIVAL[^] should indicate a new cd/usb drive.
Will probably only work if you have auto insert notification turned on for the drive.
[Edit: Oops, should have hit refresh before posting. I agree with Luc]
Simon
|
|
|
|
|
Hello,
I get the error "No conenction could be made because the target machine actively refused it 192.168.1.2:1234"
It works very fine in localhost but when i tried to connect to other pc on web it gives me above error.
So will you please help me?
Thank you.
|
|
|
|
|
Are you running the server on that PC? Did you make sure the firewall is not blocking?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hello,
I dont know how to make the firewall settings for that port.
|
|
|
|
|
krinaljariwala wrote: I dont know how to make the firewall settings for that port.
That is outside the scope of a C# question. Ask your network admin.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I want to load data that have already saved in a file to a listbox. My code here doesn't work, there's nothing happen in the listbox eventhough there are some items in the file that should be loaded to the listbox. Where is my mistake?
//the code below to load, but nothing happen
private const string Filename = "DDBlock.txt";
public void Main(String[] args)
{
this.listBoxBlockedNumberDD.Items.Clear();
if (File.Exists(Filename) == true)
{
using (StreamReader sr = File.OpenText(Convert.ToString(Filename)))
{
foreach (string Item in Filename)
{
listBoxBlockedNumberDD.Items.Add(sr.ReadLine());
}
}
}
}
//the code below to save item in listbox to a file, it works and the item is saved to the file.
private void menuItemDD_Click(object sender, EventArgs e)
{
listBoxBlockedNumberDD.Items.Add(RemoveText(textBoxPhoneNumber1.Text.Trim()));
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(Filename, true))
{
foreach (string Item in this.listBoxBlockedNumberDD.Items)
{
sw.WriteLine(Item);
}
sw.Close();
}
textBoxPhoneNumber1.Text = string.Empty;
}
|
|
|
|
|
irsalina wrote: foreach (string Item in Filename)
What do you expect this to do ? It's going to iterate once, perhaps. There is one string in filename, it's a string.
Try File.ReadAllLines instead, then use a foreach on the result, passing each string directly in, without having to use a streamreader at all.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Well, i've came out with this:
if (File.Exists(Filename) == true)
{
//Open the file and read all lines
string readDD = File.ReadAllLines(Filename);
{
foreach (string dd in readDD)
{
listBoxBlockedNumberDD.Items.Add(dd);
}
}
}
But there is an error that said "System.IO.File does not contain a definition for ReadAllLines". From what I know, System.IO has already been implemented in System.dll and mscorlib.dll and I've had those. I also have installed v1.1.4322 .Net and it should've worked. So, where do u think my fault?
Thank you so much
ichiwa
[student]
|
|
|
|
|
It's for delete data from listbox and txt file in windows mobile. I've came up until this.
private void menuItemUn_Click(object sender, EventArgs e)
{
//delete item in list box
if (listBoxBlockedNumberDD.SelectedIndex == -1)
{
MessageBox.Show("Nothing selected.", "Alert!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
return;
}
listBoxBlockedNumberDD.Items.Remove(listBoxBlockedNumberDD.SelectedItem);
//delete the item in file? what should I put in here
}
ichiwa
|
|
|
|
|
Your best bet is to overwrite the file with that line removed. You can't just remove a line from a file, it doesn't work that way. You save the file with the line gone.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hi.. i need multiple columns in Autocomplete Textbox which is reside inside the grid...
|
|
|
|
|
Reword your question because I have no idea what you mean. If you need help, take some time in wording your question properly--at least.
|
|
|
|
|
Do you mean to develop textboxes at header of grid for filtering or something like that.
I didn't understand the question clearly but try using templatecolumn
|
|
|
|
|
You might want to look for editable combobox with multi columns instead.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hello all,
In VisualStudio 6.0, there's an Export Makefile menu item
that creates a makefile for the project. Is there any way to achieve this in VS.Net 2005? Basically, I need a command-line build script for my project and was wondering if there's
an automated way to generate it for an existing VS.Net project.
Thks
T J S
|
|
|
|
|
No, and ask this in the VS forum.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I've come across some classes in the .NET framework that have no constructors defined, but are not static classes. For example, to instantiate an AppDomain class, you call the static function AppDomain.CreateDomain() which returns an instance of the AppDomain class. There are no constructors defined for the class, so you cannot instantiate the class using the new keyword.
My question is how does the CreateDomain() function instantiate the class?
Thanks in advance,
Kevin
|
|
|
|
|
This is sometimes done for Singleton Design Pattern reasons. It is instantiated like so:
Public class AppDomain
{
private AppDomain _instance;
// Notice how the constructor is protected (can be private)
protected AppDomain()
{
}
// Notice the method is static
public static CreateDomain()
{
// Below it first checks if there is already an instance created and returns it.
// Else creates and returns it
if (_instance == null)
_instance = new AppDomain();
return _instance;
}
}
|
|
|
|
|
Ah ha. Private constructors. I knew there had to be a good reason to be able to do that.
Thanks
|
|
|
|
|
|
PIEBALDconsult wrote: Shhh... that's private.
TMI!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
There's no such thing as a class with no constructor, if you don't provide a private one with no arguments, a public one is created. Otherwise, what the other guy said ( factory patterns, etc ). One common use for this would be for a single instance only to exist of a class, so you have a private constructor, in a static class, which has a property that returns the only possible instance of itself. Good for settings, for example.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
about trojans, if run taskmanager i see all threads at the moment, so it´s better to detect when user turn on and off taskmanager, right? is that possible in code? i think so.
the other way to keep trojans stealth is to mess with taskmanager code itself?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|