|
Ah, thanks, now i understand
|
|
|
|
|
Hi, i search a livrary in Framework .NET 2.0 to see the resources of systems connected to my computer in my lan, but i didn't find it.
What is the library/method to see network resources of systems in my lan (like DriveInfo, DirectoryInfo etc... for local resources)?
Thanks and excuse me for my bad english!
|
|
|
|
|
Plz try this code.........This done with the help of WMI
using System.Management;
Private ManagementObjectSearcher OS;
Private ManagementObjectSearcher CS;
Private ManagementObject Mgmt;
OS = New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
CS = New ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
For Each Mgmt In OS.Get
{
String OSName = Mgmt("name").ToString();
String OSVersion = Mgmt("version").ToString();
String ComputerName = Mgmt("csname").ToString();
String WindowsDir = Mgmt("windowsdirectory").ToString();
}
Next
For Each Mgmt In CS.Get
{
String strManufacturer = Mgmt("manufacturer").ToString();
String StrModel = Mgmt("model").ToString();
String strSystemType = Mgmt("systemtype").ToString;
String strTPM = Mgmt("totalphysicalmemory").ToString();
}
Next
Or u can also use
Environment
Environment.OSVersion.Platform like.....try other methods......
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Excuse me but i don't understand where i can find data about the drives of other systems connected to my pc.
Thanks for help!
|
|
|
|
|
I've used the exaple but i don't understand where i can see the others systems in my LAN . . .
|
|
|
|
|
I am having trouble changing icons. I edit them with the resource editor, but when I display them they haven't changed.
For instance, I'll add an icon to my assembly (Add New Item/Icon file). Then I change its Build Action Property to Embedded Resource. Then I edit the default to what I want. I retrieve the icon with:
Icon icon = new Icon(this.GetType(), "MyIcon.ico");
Lastly, I assign this icon to the Icon property of a StatusBar panel.
The problem is that the icon hasn't changed from the default image. No amount of saving, rebuilding, etc. seems to do anything. Viewing the image in the icon editor shows the changed icon. Viewing the file with a drawing program (e.g Paint) shows the changed icon. I just cannot get it to diaplsy on my form correctly.
What am I doing wrong?
Dave
|
|
|
|
|
Yes, I have had some trouble with that too.
An icon may contain several images, typically at different resolutions;
typically 16*16 and 32*32 would be present.
On Visual Studio 7.1 look at menu Image/Current Icon Image Types.
Which image of the icon file gets used depends heavily on circumstances;
it may be different for:
- the task bar button
- the form's icon
- Windows Explorer showing small icons
- Windows Explorer showing large icons
Furthermore, Windows Explorer sometimes caches the icons used in a folder
(I am not sure, maybe in Thumbs.db which may be invisible, depends on your settings).
So when designing an icon, you should edit all images it contains,
and you may want to delete the icon cache file if you can find one.
Luc Pattyn
|
|
|
|
|
Thank you, this solved most of my problems.
I must say that all this is not very intuitive. Multiple icons in one file? Also, it would be nice if the IDE's Icon Editor displayed all the images in the file or gave you a hint that there may be more than one. Oh well.
Another question: You mentioned that the icon plucked from the file depends on circumstances. Is there any way of extracting a specific icon from a file? For instance, I get the icon with:
statusBarPanel.Icon = new Icon(this.GetType(), "MyIcon.ico");
This seems to look for the 16x16 icon. What if I had a circumstance where I wanted a specific size (color...) rather than the default?
Thanks,
Dave
|
|
|
|
|
Well, all those images together form only one icon, so you better make sure they all
look alike.
I know of no way to pick a specific image from an icon.
If you want to pick a specific icon from many, keep them well apart, i.e. in separate
files, or in separate resources.
BTW there also exists a way to pack multiple icons (each possibly with multiple images)
into a single file, I have forgotten all details tho. Maybe its called an icon list ?
Luc Pattyn
|
|
|
|
|
I think your problem is that you are calling "MyIcon.ico" so it's looking for that file in the current directory. If you are embedding the ico as an ebedded resource it won't be there.
You'll need to use Reflection to get the embedded Icon.
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream stream = assembly.GetManifestResourceStream("WindowsApplication3.Icon1.ico");
Icon icon = new Icon(stream);
this.Icon = icon;
|
|
|
|
|
if you hav ur icons on the resource manager, it is easy to pic the icons. VS hav some built in functions for that
use the following code.. (not tested)
statusbar.Icon = global::namespace.Properties.Resources.icon;
namespace - give your name space name.
icon - name of the image added in the resource manager.
hope this helps
|
|
|
|
|
Hello everyone!
My VS crashed for the first time like 2 or 3 days ago when I was working. I got the Microsoft error reporter and everything. I reopened VS and it crashed again. I opened it a third time and it said it skipped document loading because last time there were errors.
So I had a rest from that project. Today *, I re-opened it, and everything seemed to work fine. However, when I tried to open Form1.cs in design mode, the program disappeared... No error, no nothing, just showed my desktop... I noticed a little icon in the system tray, but it went away as soon as I hovered it with the mouse...
Everything else works, code view for that same file doesn't have any problems, I can open another form in both modes and it works fine too... I tried excluding the file from the project and re-adding it, doesn't work...
The app closes so fast that it surprised me... You know like, it always takes a while to show the error before it crashes...
Anyone know what's wrong? Thanks!
* I'm not sure if this is relevant or not... But, after the "rest" I had from this project, I moved it to my new flash drive.
Windows Calculator told me I will die at 28.
|
|
|
|
|
Lord Kixdemp wrote: I noticed a little icon in the system tray, but it went away as soon as I hovered it with the mouse...
A NotifyIcon that does not get Disposed() acts exactly like that.
I have had some trouble when using two versions of Visual working inside the same folder,
when I tried to develop and share code for both .NET 1.1 and 2.0
I frequently have to delete the entire obj folder (when trying to use Visual 7.1 after
Visual 8.0 did a build).
And sometimes I have to explicitly "Rebuild Solution" when a small mistake ends up in
dozens of error messages, that otherwise dont go away when the error got fixed.
So my suggestions: delete obj, and Rebuild solution.
Luc Pattyn
|
|
|
|
|
|
Nevermind, my custom control was broken...
Windows Calculator told me I will die at 28.
|
|
|
|
|
hi,
i want to know how a universal conection can be built so that my programe with a small dataBase
file can be opened on the others pcs as well without giving a new connection string.giving connection string at every other pc ,i want to avoid this.
|
|
|
|
|
You need the physical address of the database file to open the connection, but if you place the database file at the same relative position to the executable all the time, you can create the path by getting the path of the executable and add the relative path to the database.
---
Year happy = new Year(2007);
|
|
|
|
|
here is my app.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<dataConfiguration defaultDatabase="SqlConnection" />
<connectionStrings>
<add name="SqlConnection" connectionString="server=Developer;database=MSPetShop;Integrated Security=true;"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
first i m getting these two errors:
Message 1 Could not find schema information for the element 'dataConfiguration'.
Message 2 Could not find schema information for the attribute 'defaultDatabase'.
and when i try to call the from my DAL layer i got exception
i m using this funcion
Database db=DatabaseFactory.CreateDatabase();
I hope any one there will reply me many thanks,
adnan
|
|
|
|
|
Hi,
Please make sure that the assembly and the project name specified in the configSections of the app.config is same as what you have in your project.
Thanks
Rakheesh
|
|
|
|
|
Why in .NET 2.0 framework an instruction as under brought back SHOW the millisecond and in framework .NET 2.0 CF (same function, identical code) the millisecond do not SHOW? I have tried also with the Application.DoEvents but nothing ... why?
Es..
private long m_lInitialTick;
private void StartCrono()
{
m_lInitialTick = DateTime.Now.Ticks;
timerTmp.Interval = 1;
timerTmp.Enabled = true;
}
private void StopCrono()
{
timerTmp.Enabled = false;
}
private void timerTmp_Tick(object sender, EventArgs e)
{
label.Text = Convert.ToString((DateTime.Now.Ticks - m_lInitialTick) / 10000) ;
}
|
|
|
|
|
What is the timerTmp that you are using? Is it a timer control?
You are using an awfully short interval. If you update the label a thousand times a second, you are updating it somewhere between ten and twenty times as often as the screen is able to show it.
How do you call the code? If the main thread is busy after you have started the timer, it won't handle the tick events.
---
Year happy = new Year(2007);
|
|
|
|
|
You are both up for a big disappointment:
the system normally is not able to run a timer periodically with a period as small as
1 millisecond. Actually the following code runs for more than 15 seconds:
public class CPTest_FastTimer: CPTest {
System.Windows.Forms.Timer timer=new System.Windows.Forms.Timer();
int count=0;
DateTime start;
public override void Run(int arg) {
start=DateTime.Now;
log("start = "+start.ToString("HH:mm:ss.fff"));
timer.Interval=1;
timer.Tick+=new EventHandler(timer_Tick);
timer.Start();
}
private void timer_Tick(object sender, EventArgs e) {
count++;
if (count>=1000) {
log("got "+count+" ticks between "+start.ToString("HH:mm:ss.fff")+
" and "+DateTime.Now.ToString("HH:mm:ss.fff"));
timer.Stop();
}
}
}
On my system this generates the line
CPTest.log: got 1000 ticks between 15:12:47.140 and 15:13:02.953
What goes on is a timer creates a delay which tries to equal the smallest possible delay
equal to OR larger than what was asked for; since the system clock normally ticks at 64
Hz, this means all intervals shorter than 15 msedc get enlarged to that number !
BTW: there is a way to set the system clock in a "higher accuracy" mode, but I do not
recall how, and MS does not set it by default to preserve CPU resources and power ...
Luc Pattyn
|
|
|
|
|
This has absolutely no relevance, but:
class UglyClass {
public UglyClass() {
if (true) {
DoThis();
DoThat();
}
if (true) DoSomethingElse();
}
}
class PrettyClass
{
public PrettyClass()
{
if (true)
{
DoThis();
DoThat();
}
if (true)
{
DoSomethingElse();
}
}
}
|
|
|
|
|
bobsugar222 wrote: This has absolutely no relevance
I agree. I would add, your way wastes more space.
Luc Pattyn
|
|
|
|
|
Easier to read and maintain though... on top of being prettier
|
|
|
|