الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤال عن ال Arrays

بدأه إشراقة فجر في 4 يناير 2009 · 10 رد · 824 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمه الله وبركــآته ,,,

عندي إستفســـآآر بسيط عن هالكـــــود ,,

مثلاً لو المصفوفه أسمهـــآآ Students

Students.GetUpperBound(0)

مآ وظيفه هالدآلـــه ؟؟

الله يجزآآكم خيــــــــــر ...

سآآعدوني ,,

عندي أختبــآر بكرهـ ..!!

..

تم تعديل هذه المشاركة بواسطة إشراقــه فجــر في 4 يناير 2009 في 20:01

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

#2

Array.GetUpperBound عميلة ذات مرجع عددي (عدد صحيح Integer ) تعيد قيمة الحد الأقصى لمصفوفة ما, يمكنك أيضاً استخدام العملية UBound التي لها نفس العمل .

مثال :

Dim MyString(0 To 100) As Integer

Private Sub Button1_Click(Byval Sender As System.Object, Byval E As System.EventArgs ) Handles Button1.Click

MsgBox( MyStrings.GetUpperBound(0) )

MsgBox( UBound( MyString) )

End Sub

تستخدم هذه العملية لاختصار :

MsgBox( CInt( MyString.Length - 1) )

إذا كان لديك مصفوفة لها هذا الشكل : MyMatrix( 5, 10, 15, 20, 25 )

امثلة مع حلول :

MyMatrix.GetUpperBound( 0 ) = 5 أو UBound( MyMatrix, 0 ) = 5

MyMatrix.GetUpperBound( 1 ) = 10 أو UBound( MyMatrix, 1 ) = 10

MyMatrix.GetUpperBound( 2 ) = 15 أو UBound( MyMatrix, 2 ) = 15

MyMatrix.GetUpperBound( 3 ) = 20 أو UBound( MyMatrix, 3 ) = 20

MyMatrix.GetUpperBound( 4 ) = 25 أو UBound( MyMatrix, 4 ) = 25

لتحصيل مجموع الخلايا, يمكنك استخدام حلقة تكرارية :

Dim CellsCount As Integer = MyMatrix.GetUpperBound( 0 )

For I As Integer = 1 To 4

CellsCount *= MyMatrix.GetUpperBound( I )

Next I

MsgBox( CellsCount.ToString )

تم تعديل هذه المشاركة بواسطة Bashar Rabat في 4 يناير 2009 في 20:26

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#3

جزآآك الله خيــر ع المســآعدهـ ,,

والله يجعله بميزآآن حسنآتك ,,

..

سؤآل آخــر ,,

لو عندي ســؤآل "صممي برنآمج يقوم بقرآءه درجآت الطلاب مثلاً ..!"

مآ معنى يقرأ ؟؟

..

أتمنـى يكون سؤآلي مفهوم .. !!

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

#4

باستخدام الـ( Console Application او Windows Application ) ؟

مانوع مصدر المعلومات ( ( Text File, Binary File ) أو ( MSFT Access DB, MSFT SQL Server DB) ) ؟

يقرأ ( جميع معلومات الطلاب أو درجاتهم فقط ) ؟

تم تعديل هذه المشاركة بواسطة Bashar Rabat في 4 يناير 2009 في 20:48

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#5

أقـصد ..

لو السؤال ..

أكتبي برنـامـج يقوم بقراءه درجات الطلاب

لمـاده وحده أو عده مواد ..

يعني درجــات الطلاب مو من مصدر كمـا ذكــرت ..

تم تعديل هذه المشاركة بواسطة إشراقــه فجــر في 4 يناير 2009 في 21:35

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

#6

عذراً, هل يمكنك التوضح بدون استخدام طرق فرعية للكتابة كـ( آ, هـ ), من دون مصدر ؟

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#7

لتوضيح ..

مثلاً في برنامج أياً كان

وفيه مصفوفه ذات بعد واحد يتم فيها تخزين درجات الطلاب ..

..

متى أقول أن البرنامج يقرأ درجات الطلاب ؟؟

يعني وش يسوي البرنامج و أقول أنه يقرأ درجات الطلاب ..

وشكراً

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

#8

مثال Windows Application :

 

Dim StudentsM[color= #009900;]([color= #cc66cc;]139[color= #009900;]) [color= #b1b100;]As Double

 

[color= #000000; font-weight: bold;]Private Sub BtnSetInformation_Click[color= #009900;]( Byval Sender [color= #b1b100;]As [color= #990000;]System[color= #339933;].Object[color= #339933;], [color= #990000;]_

Byval E [color= #b1b100;]As [color= #990000;]System[color= #339933;].EventArgs [color= #009900;]) Handles BtnSetInformation[color= #339933;].Click

[color= #b1b100;]For I [color= #b1b100;]As Integer [color= #339933;]= [color= #cc66cc;]0 To UBound[color= #009900;]( StudentM [color= #009900;])

StudentsM [color= #339933;]= Rnd[color= #009900;]([color= #009900;]) [color= #339933;]* I

[color= #990000;]Next I

[color= #990000;]End Sub

 

[color= #000000; font-weight: bold;]Private Sub BtnReadInformation_Click[color= #009900;](Byval Sender [color= #b1b100;]As [color= #990000;]System[color= #339933;].Object[color= #339933;], 

Byval E [color= #b1b100;]As [color= #990000;]System[color= #339933;].EVentArgs [color= #009900;]) Handles BtnReadInformation[color= #339933;].Click

[color= #b1b100;]For I [color= #b1b100;]As Integer [color= #339933;]= [color= #cc66cc;]0 To UBound[color= #009900;]( StudentsM [color= #009900;])

TextBox1[color= #339933;].Text [color= #339933;]&= String[color= #339933;].Format[color= #009900;]( [color= #0000ff;]"Student ID : {0}, Student M : {1}"[color= #339933;], I[color= #339933;].ToString[color= #339933;], StudentsM[color= #009900;]( I[color= #009900;]) 
[color= #009900;]) [color= #339933;]& [color= #009900;]([color= #990000;]Chr[color= #009900;]([color= #cc66cc;]13[color= #009900;]) [color= #339933;]& [color= #990000;]Chr[color= #009900;]([color= #cc66cc;]13[color= #009900;]) [color= #009900;])

[color= #990000;]Next I

[color= #990000;]End Sub

مثال Console Application :

 

Module Students

Dim StudentsM[color= #009900;]([color= #cc66cc;]139[color= #009900;]) [color= #b1b100;]As Double

 

Sub Main

[color= #b1b100;]For I [color= #b1b100;]As Integer [color= #339933;]= [color= #cc66cc;]0 To UBound[color= #009900;]( StudentM [color= #009900;])

StudentsM [color= #339933;]= Rnd[color= #009900;]([color= #009900;]) [color= #339933;]* I

Console[color= #339933;].WriteLine[color= #009900;]( [color= #0000ff;]"Student ID : {0}, Student M : {1}"[color= #339933;], I[color= #339933;].ToString[color= #339933;], StudentsM[color= #009900;]( I[color= #009900;]) [color= #009900;])

[color= #990000;]Next I

[color= #990000;]End Sub

 

[color= #990000;]End Module

تم تعديل هذه المشاركة بواسطة Bashar Rabat في 4 يناير 2009 في 21:57

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#9

جزاك الله خيــر ..

واللي فهمته من الأمثله أن القراءه هي إدخــال ؟؟

أي .. أن القراءه هي عمليه أدخال الدرجات ..

صح ؟؟

..

تم تعديل هذه المشاركة بواسطة إشراقــه فجــر في 4 يناير 2009 في 22:10

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

#10

ليس يمعنى ( إدخال = إدخال ) لأننا نتعامل مع مصفوفة, عملية الإدخال التي استخدمتها في المثالين السابقين هي فقط لإكمال المثال ببعض المعلومات ( ليس الا ) .

عندما تعرضين شيء للمستخدم ليقرأه ( هذا مايسمى بالقراءة ), الست ( عربياً, عريبة ) ؟ :P

عملية اخرى تسمى القراءة, وهي استخدام Stream ليقرأ من والى مكان معين أو قراءة سطر من الأسطر ..

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#11

جـــزآآك الله خيــــر على التوضيح ...

جعله الله في ميزآآن حسنـآتك ..

..

سبحآن الله وبحمده .. سبحآن الله العظيم .. ,

مواضيع مشابهة