Favorilerine Ekle | Giriş Sayfan Yap | Tavsiye Et

 

Kurs Tanıtım Sayfası | Süper Üye Kimdir? | Menü Tasarımı Konulu Örnek Ders
Kod İndir| Hazır Kodlar | Makaleler| İpuçları | VB .NET Kursu | Dersler | Forum | Alt Bölümler | Servisler
    Merhaba Misafir
    anasayfa » visual basic hazır kodlar » .Net System Information
Üye Girişi
Kullanıcı Adı:  
Şifre : 
Kaydet ?
Siteden tam olarak faydalanabilmek için üye olmalısınız.
Unuttuğunuz şifrenizi öğrenebilmek için kayıt sırasında verdiğiniz Hatırlatma Cevabı'nı bilmeniz gereklidir.
Şifre hatırlatma işlevini sadece 3 defa kullanma hakkınız vardır.
Kullanıcı adını ve şifresini unutan üyelere email ile yardım verilmez.

Aktivasyon Gelmedi mi?Aktivasyon mesajınız email adresinize gelmedi mi?
Buraya tıklayarak bir kez daha aktivasyon mesajı gönderilmesini sağlayabilirsiniz.
Lütfen email hesabınızın BULK ve SPAM klasörlerini de kontrol ediniz.
Rastgele Makale

VB.NET İLE MICROSOFT WORD UYGULAMALARI

Yazar: tturkmen
Bu makalede Visual Studio.NET ile nasıl Microsoft Office Word dokümanı ile çalışacağımızı ve bu dökumanları dinamik olarak nasıl yöneteceğimizi göreceğiz.



Webmasterlar
Sitenize Ekleyin!
Sitenizde "Son Eklenen 10 Visual Basic Yazısı"'nı göstermek ve içeriğini zenginleştirmek için buraya tıklayınız.

Vbasicmaster.com'a link verin!
Aşağıdaki minik banneri sitenize eklemek için tıklayın!

Üye Sayısı:
Ziyaretçiler nerede?
Yayın № : 8010
Yayın Tar:15.11.2006
Yazar : programmar
Hit :2140

Bu Yazarın Yazıları Sadece bu yazarın  göster
Bu Yazıyı Tavsiye Et

İlk önce general tanımlamaları yapılıyor.

Visual Basic (Declaration)
Public Class SystemInformation

Visual Basic (Usage)
Dim instance As SystemInformation


C#
Public Class SystemInformation

C++
Public ref Class SystemInformation

J#
Public Class SystemInformation

JScript
Public Class SystemInformation


-----------------------------------------------------------------------------------------

Daha sonra formunuza 1 tane listbox ve 1 tane textbox ekleyin ve şu kodları yazın.

***Vb.Net Kodu***

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms

Public Class SystemInfoBrowserForm
Inherits System.Windows.Forms.Form

Private listBox1 As System.Windows.Forms.ListBox
Private textBox1 As System.Windows.Forms.TextBox

Public Sub New()
Me.SuspendLayout()
InitForm()

' Add Each Property of the SystemInformation Class To the list box.
Dim t As Type = GetType(System.Windows.Forms.SystemInformation)
Dim pi As PropertyInfo() = t.GetProperties()
Dim i As Integer
For i = 0 To pi.Length - 1
listBox1.Items.Add(pi(i).Name)
Next i
textBox1.Text = "The SystemInformation Class has " + pi.Length.ToString() + " properties." + ControlChars.CrLf

' Configure the list item selected handler For the list box To invoke a
' method that displays the value of Each Property.
AddHandler listBox1.SelectedIndexChanged, AddressOf listBox1_SelectedIndexChanged

Me.ResumeLayout(False)
End Sub

Private Sub listBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
' Return If no list item Is selected.
If listBox1.SelectedIndex = - 1 Then
Return
End If
' Get the Property name from the list item.
Dim propname As String = listBox1.Text

If propname = "PowerStatus" Then
' Cycle And display the values of Each Property of the PowerStatus Property.
textBox1.Text += ControlChars.CrLf + "The value of the PowerStatus Property Is:"
Dim t As Type = GetType(System.Windows.Forms.PowerStatus)
Dim pi As PropertyInfo() = t.GetProperties()
Dim i As Integer
For i = 0 To pi.Length - 1
Dim propval As Object = pi(i).GetValue(SystemInformation.PowerStatus, Nothing)
textBox1.Text += ControlChars.CrLf + " PowerStatus." + pi(i).Name + " Is: " + propval.ToString()
Next i
Else
' Display the value of the selected Property of the SystemInformation Type.
Dim t As Type = GetType(System.Windows.Forms.SystemInformation)
Dim pi As PropertyInfo() = t.GetProperties()
Dim prop As PropertyInfo = Nothing
Dim i As Integer
For i = 0 To pi.Length - 1
If pi(i).Name = propname Then
prop = pi(i)
Exit For
End If
Next i
Dim propval As Object = prop.GetValue(Nothing, Nothing)
textBox1.Text += ControlChars.CrLf + "The value of the " + propname + " Property Is: " + propval.ToString()
End If
End Sub

Private Sub InitForm()
' Initialize the form settings
Me.listBox1 = New System.Windows.Forms.ListBox()
Me.textBox1 = New System.Windows.Forms.TextBox()
Me.listBox1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
Me.listBox1.Location = New System.Drawing.Point(8, 16)
Me.listBox1.Size = New System.Drawing.Size(172, 496)
Me.listBox1.TabIndex = 0
Me.textBox1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
Me.textBox1.Location = New System.Drawing.Point(188, 16)
Me.textBox1.Multiline = True
Me.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.textBox1.Size = New System.Drawing.Size(420, 496)
Me.textBox1.TabIndex = 1
Me.ClientSize = New System.Drawing.Size(616, 525)
Me.Controls.Add(Me.textBox1)
Me.Controls.Add(Me.listBox1)
Me.Text = "Select a SystemInformation Property To Get the value of"
End Sub

<STAThread()> _
Shared Sub Main()
Application.Run(New SystemInfoBrowserForm())
End Sub

End Class

-------------------------------------------------------------------------
***C# Copy Code ***
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;

namespace SystemInfoBrowser
{
Public Class SystemInfoBrowserForm : System.Windows.Forms.Form
{
Private System.Windows.Forms.ListBox listBox1;
Private System.Windows.Forms.TextBox textBox1;

Public SystemInfoBrowserForm()
     {
this.SuspendLayout();
InitForm();

// Add Each Property of the SystemInformation Class To the list box.
Type t = typeof(System.Windows.Forms.SystemInformation);
PropertyInfo[] pi = t.GetProperties();
For( Int i=0; i<pi.Length; i++ )
listBox1.Items.Add( pi<i>.Name );
textBox1.Text = "The SystemInformation Class has "+pi.Length.ToString()+" properties./r/n";

// Configure the list item selected handler For the list box To invoke a
// method that displays the value of Each Property.
listBox1.SelectedIndexChanged += New EventHandler(listBox1_SelectedIndexChanged);
this.ResumeLayout(False);
     }
        
Private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
// Return If no list item Is selected.
If( listBox1.SelectedIndex == -1 ) Return;
// Get the Property name from the list item.
String propname = listBox1.Text;

If( propname == "PowerStatus" )
{
// Cycle And display the values of Each Property of the PowerStatus Property.
textBox1.Text += "/r/nThe value of the PowerStatus Property Is:";
Type t = typeof(System.Windows.Forms.PowerStatus);
PropertyInfo[] pi = t.GetProperties();
For( Int i=0; i<pi.Length; i++ )
{
object propval = pi<i>.GetValue(SystemInformation.PowerStatus, Null);
textBox1.Text += "/r/n PowerStatus."+pi<i>.Name+" Is: "+propval.ToString();
}
}
Else
{
// Display the value of the selected Property of the SystemInformation Type.
Type t = typeof(System.Windows.Forms.SystemInformation);
PropertyInfo[] pi = t.GetProperties();
PropertyInfo prop = Null;
For( Int i=0; i<pi.Length; i++ )
If( pi<i>.Name == propname )
{
prop = pi<i>;
break;
}
object propval = prop.GetValue(Null, Null);
textBox1.Text += "/r/nThe value of the "+propname+" Property Is: "+propval.ToString();
}
}

Private void InitForm()
{
// Initialize the form settings
this.listBox1 = New System.Windows.Forms.ListBox();
this.textBox1 = New System.Windows.Forms.TextBox();
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.Location = New System.Drawing.Point(8, 16);
this.listBox1.Size = New System.Drawing.Size(172, 496);
this.listBox1.TabIndex = 0;
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = New System.Drawing.Point(188, 16);
this.textBox1.Multiline = True;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = New System.Drawing.Size(420, 496);
this.textBox1.TabIndex = 1;
this.ClientSize = New System.Drawing.Size(616, 525);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.listBox1);
this.Text = "Select a SystemInformation Property To Get the value of";
}

[STAThread]
Static void Main()
{
Application.Run(New SystemInfoBrowserForm());
}
}
}

-------------------------------------------------------------------------------

***C++ Copy Code ***
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Drawing;
using namespace System::Reflection;
using namespace System::Windows::Forms;
Public ref Class SystemInfoBrowserForm: Public System::Windows::Forms::Form
{
Private:
System::Windows::Forms::ListBox^ listBox1;
System::Windows::Forms::TextBox^ textBox1;

Public:
SystemInfoBrowserForm()
{
this->SuspendLayout();
InitForm();

// Add Each Property of the SystemInformation Class To the list box.
Type^ t = System::Windows::Forms::SystemInformation::typeid;
Array<PropertyInfo^>^pi = t->GetProperties();
For ( Int i = 0; i < pi->Length; i++ )
listBox1->Items->Add( pi[ i ]->Name );
textBox1->Text = String::Format( "The SystemInformation Class has {0} properties./r/n", pi->Length );

// Configure the list item selected handler For the list box To invoke a
// method that displays the value of Each Property.
listBox1->SelectedIndexChanged += gcnew EventHandler( this, &SystemInfoBrowserForm::listBox1_SelectedIndexChanged );
this->ResumeLayout( False );
}


Private:
void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{

// Return If no list item Is selected.
If ( listBox1->SelectedIndex == -1 )
Return;


// Get the Property name from the list item.
String^ propname = listBox1->Text;
If ( propname->Equals( "PowerStatus" ) )
{

// Cycle And display the values of Each Property of the PowerStatus Property.
textBox1->Text = String::Concat( textBox1->Text, "/r/nThe value of the PowerStatus Property Is:" );
Type^ t = System::Windows::Forms::PowerStatus::typeid;
Array<PropertyInfo^>^pi = t->GetProperties();
For ( Int i = 0; i < pi->Length; i++ )
{
Object^ propval = pi[ i ]->GetValue( SystemInformation::PowerStatus, nullptr );
textBox1->Text = String::Format( "{0}/r/n PowerStatus.{1} Is: {2}", textBox1->Text, pi[ i ]->Name, propval );

}
}
Else
{

// Display the value of the selected Property of the SystemInformation Type.
Type^ t = System::Windows::Forms::SystemInformation::typeid;
Array<PropertyInfo^>^pi = t->GetProperties();
PropertyInfo^ prop = nullptr;
For ( Int i = 0; i < pi->Length; i++ )
If ( pi[ i ]->Name == propname )
{
prop = pi[ i ];
break;
}
Object^ propval = prop->GetValue( nullptr, nullptr );
textBox1->Text = String::Format( "{0}/r/nThe value of the {1} Property Is: {2}", textBox1->Text, propname, propval );
}
}

void InitForm()
{

// Initialize the form settings
this->listBox1 = gcnew System::Windows::Forms::ListBox;
this->textBox1 = gcnew System::Windows::Forms::TextBox;
this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
this->listBox1->Location = System::Drawing::Point( 8, 16 );
this->listBox1->Size = System::Drawing::Size( 172, 496 );
this->listBox1->TabIndex = 0;
this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right);
this->textBox1->Location = System::Drawing::Point( 188, 16 );
this->textBox1->Multiline = True;
this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
this->textBox1->Size = System::Drawing::Size( 420, 496 );
this->textBox1->TabIndex = 1;
this->ClientSize = System::Drawing::Size( 616, 525 );
this->Controls->Add( this->textBox1 );
this->Controls->Add( this->listBox1 );
this->Text = "Select a SystemInformation Property To Get the value of";
}

};


[STAThread]
Int main()
{
Application::Run( gcnew SystemInfoBrowserForm );
}

--------------------------------------------------------------------------------------


***J# Copy Code ***
package SystemInfoBrowser;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Drawing.*;
import System.Reflection.*;
import System.Windows.Forms.*;

Public Class SystemInfoBrowserForm extends System.Windows.Forms.Form
{
Private System.Windows.Forms.ListBox listBox1;
Private System.Windows.Forms.TextBox textBox1;

Public SystemInfoBrowserForm()
{
this.SuspendLayout();
InitForm();
// Add Each Property of the SystemInformation Class To the list box.
Type t = System.Windows.Forms.SystemInformation.Class.ToType();
PropertyInfo pi[] = t.GetProperties();
For (Int i = 0; i < pi.length; i++) {
listBox1.get_Items().Add(pi<i>.get_Name());
}
textBox1.set_Text("The SystemInformation Class has "
+ ((Int32)pi.length).ToString() + " properties./r/n");
// Configure the list item selected handler For the list box To invoke
// a method that displays the value of Each Property.
listBox1.add_SelectedIndexChanged(
New EventHandler(listBox1_SelectedIndexChanged));
this.ResumeLayout(False);
} //SystemInfoBrowserForm

Private void listBox1_SelectedIndexChanged(Object sender, EventArgs e)
{
// Return If no list item Is selected.
If (listBox1.get_SelectedIndex() == -1) {
Return;
}
// Get the Property name from the list item.
String propname = listBox1.get_Text();

If (propname.Equals("PowerStatus")) {
// Cycle And display the values of Each Property of the
// PowerStatus Property.
textBox1.set_Text(textBox1.get_Text()
+ "/r/nThe value of the PowerStatus Property Is:");
Type t = System.Windows.Forms.PowerStatus.Class.ToType();
PropertyInfo pi[] = t.GetProperties();
For (Int i = 0; i < pi.length; i++) {
Object propval = pi<i>.GetValue(
SystemInformation.get_PowerStatus(), Null);
textBox1.set_Text(textBox1.get_Text()
+ "/r/n PowerStatus." + pi<i>.get_Name()
+ " Is: " + propval.ToString());
}
}
Else {
// Display the value of the selected Property of the
// SystemInformation Type.
Type t = System.Windows.Forms.SystemInformation.Class.ToType();
PropertyInfo pi[] = t.GetProperties();
PropertyInfo prop = Null;
For (Int i = 0; i < pi.length; i++) {
If (pi<i>.get_Name().Equals(propname)) {
prop = pi<i>;
break;
}
}
Object propval = prop.GetValue(Null, Null);
textBox1.set_Text(textBox1.get_Text() + "/r/nThe value of the "
+ propname + " Property Is: " + propval.ToString());
}
} //listBox1_SelectedIndexChanged

Private void InitForm()
{
// Initialize the form settings
this.listBox1 = New System.Windows.Forms.ListBox();
this.textBox1 = New System.Windows.Forms.TextBox();
this.listBox1.set_Anchor((System.Windows.Forms.AnchorStyles)
(System.Windows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom
| System.Windows.Forms.AnchorStyles.Left
| System.Windows.Forms.AnchorStyles.Right));
this.listBox1.set_Location(New System.Drawing.Point(8, 16));
this.listBox1.set_Size(New System.Drawing.Size(172, 496));
this.listBox1.set_TabIndex(0);
this.textBox1.set_Anchor((System.Windows.Forms.AnchorStyles)
(System.Windows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom
| System.Windows.Forms.AnchorStyles.Right));
this.textBox1.set_Location(New System.Drawing.Point(188, 16));
this.textBox1.set_Multiline(True);
this.textBox1.set_ScrollBars(System.Windows.Forms.ScrollBars.Vertical);
this.textBox1.set_Size(New System.Drawing.Size(420, 496));
this.textBox1.set_TabIndex(1);
this.set_ClientSize(New System.Drawing.Size(616, 525));
this.get_Controls().Add(this.textBox1);
this.get_Controls().Add(this.listBox1);
this.set_Text("Select a SystemInformation Property To Get the value of");
} //InitForm

/** @attribute STAThread()
*/
Public Static void main(String[] args)
{
Application.Run(New SystemInfoBrowserForm());
} //main
} //SystemInfoBrowserForm


Kaynak: MSDN Kütüphanesi - Ağustos 2006 Serisi ( Çok guzel kaynak )
onaylayan: Webmaster




Bu sayfa için henüz yorum eklenmemiş.

© Hakan Ersöz 2000-2013| Üyelik Sözleşmesi | | Ödeme Bildirimi
Sitemizden yenilikleri hemen öğrenin, pop upları engelleyin, chat yapın... ToolBarımızı indirin:
Vasicmaster Toolbar'ı indirin