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

تحويل من vb إلى vb.net

مغلق
بدأه mohcool في 10 يناير 2005 · 13 رد · 1,496 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

تحويل من vb إلى vb.net

السلام عليكم يا إخوان عندي كود vb و أردت أن أحوله حولت كله وبقي لي سطر واحد لم أفهمه يا رييت ممن لديه خبرة في ال vb وال vb.net

يفسرلي هذا الكود أو يحولي إياه هذا هو الكود

 
Dim IPAddress(10) As Byte

 For i = 1 To lenIP
        IPAddress(i - 1) = Asc(Right((Left(strIP, i)), 1))
    Next
X = BII_Open_TCPIP_Communications(IPAddress(0), 10001)

هذا كله فاهمه ولكن السطر إلي مش فاهمه هوه

 IPAddress(i - 1) = Asc(Right((Left(strIP, i)), 1))
#2

و هل الstrIP معرف على انه string ؟؟؟

اقتباس
الـ VB هى الأساس ... بتبرمج بيها بالاحساس

ولا سيمي كولن ولا أقواس ... وتعلمها سهل لكل الناس

راكب فيها موتور نفاث ... دي سريعه جدا وباخلاص

الـ VB هى التراث ... للذكور والايناث :D

الـ VB لغة عريقه ... حتى اسأل Anwarica

من ديوان الشاعر السي شاربي "معتز شمس"
#3

بالطبع يا Undo وإلا كيف يريد أن يأخذ ال Left ثم ال Right؟؟؟ ماذا أفطرت هذا الصباح :lol:

Learn Japanese :>>> http://www.nouben.com/

#4

نعم يا أخ undo عبارة عن IP ADDRESS وال lenip عبارة عن ip address length

أنا ما شتغلت على vb يا ريت بس لو تحكولي إيش هو الناتج بعد الإنتهاء من جملة الفور على سبيل أن IP =192.168.10.92 و أنا بانتظار الإجابه على أحر من الجمر

#5

إذا سمح لي الأخ Undo أن أجيب بالنيابة عنه، أكتب الكود التالي:

IPAddress(i - 1) = Asc(Microsoft.VisualBasic.Right((Microsoft.VisualBasic.Left(strIP, i)), 1))

بدلاً من:

IPAddress(i - 1) = Asc(Right((Left(strIP, i)), 1))

Learn Japanese :>>> http://www.nouben.com/

#6

أشكرك يا أخ هارون على الإجابة ولقد وجدت الحل البديل لها و إشتغل معي 100%

IP_ADDRESS(i - 1) = Asc(Mid(strIP,i,1))
#7

السلام عليكم

معلش أنا بغلبكم معاي كان عندي سؤال ثاني

أنا بالأصل عمالي بحول من c++ إلى vb.net

وعندي structure وهو كالتالي

typedef struct {
	unsigned long	id;
	unsigned long	employee_id;  
	unsigned long	password;  	

	unsigned char	sensor_version;
	unsigned char	template_version;	
	char  name[16];  	
	unsigned char	finger;    
	unsigned char	admin_level;  
	unsigned char	schedule;  	
	unsigned char	security_thresh;	

	unsigned char	noise_level[18];	
	unsigned char	corramb[NUM_CORE];  	
	unsigned char	ihcore[NUM_CORE];	
	unsigned char	ivcore[NUM_CORE];	
	unsigned char	temp_xoffset;  
	unsigned char	temp_yoffset;  
	unsigned char	index;    
	unsigned char	inphase[PACKED_ARRAY_SIZE];	
} BII_Template;

حولتو إلي vb وأصبح على الشكل التالي

Public Type BII_Template
ID As Long
employee_id As Long
password As Long
sensor_version As Byte
template_version As Byte
name(15) As Byte
finger As Byte
admin_level As Byte
schedule As Byte
security_thresh As Byte
noise_level(17) As Byte
corramb(2) As Byte
ihcore(2) As Byte
ivcore(2) As Byte
temp_xoffset As Byte
temp_yoffset As Byte
index As Byte
inphase(5499) As Byte
end type

وأردت تحويله إلى vb.net يا ريت أعرف كيف

حيث أنه لا نستطيع تحديد حجم المصفوفة(array) داخل structure

تم تعديل هذه المشاركة بواسطة mohcool في 13 يناير 2005 في 11:28

#8

يا ريت يا إخوان أحد يرد علي الموضوع مستعجل عليه

#9

أن حولت التركيب إلى

 Public Structure BII_Template
        Public ID As Integer
        Public employee_id As Integer
        Public password As Integer
        Public sensor_version As Byte
        Public template_version As Byte
        Public name() As Byte     '15
        Public finger As Byte
        Public admin_level As Byte
        Public schedule As Byte
        Public security_thresh As Byte
        Public noise_level() As Byte         '17
        Public corramb() As Byte        '2
        Public ihcore() As Byte            '2
        Public ivcore() As Byte        '2
        Public temp_xoffset As Byte
        Public temp_yoffset As Byte
        Public index As Byte
        Public inphase() As Byte        '238 ' only 284 bytes needed for 1-to-1
    End Structure

و أعدت تعريف المصفوفات

ReDim the_template.name(20)
        ReDim the_template.noise_level(180)
        ReDim the_template.corramb(20)
        ReDim the_template.ihcore(20)
        ReDim the_template.ivcore(20)
        ReDim the_template.inphase(20)

ولكن أوجه مشكلة وهي

Object reference not set to an instance of an object

عند منادات الفنكشن

 Private Declare Function BII_Get_Template Lib "bii_V1100.dll" (ByVal template_number As Integer, ByVal template_index As Integer, ByRef the_template As BII_Template) As Integer

يا ريت حدا يحكيلي ماذا أفعل

#10

أراك متصلاً..

انتظر قليلاً ..

اقتباس
الـ VB هى الأساس ... بتبرمج بيها بالاحساس

ولا سيمي كولن ولا أقواس ... وتعلمها سهل لكل الناس

راكب فيها موتور نفاث ... دي سريعه جدا وباخلاص

الـ VB هى التراث ... للذكور والايناث :D

الـ VB لغة عريقه ... حتى اسأل Anwarica

من ديوان الشاعر السي شاربي "معتز شمس"
#11

بدلاً من استخدام structure يمكنك استخدام كلاس و في هذه الحالة يمكنك تعريف حدود اولية للمصفوفات..

Public Class BII_Template
    Dim ID As Long
    Dim employee_id As Long
    Dim password As Long
    Dim sensor_version As Byte
    Dim template_version As Byte
    Dim name(15) As Byte
    Dim finger As Byte
    Dim admin_level As Byte
    Dim schedule As Byte
    Dim security_thresh As Byte
    Dim noise_level(17) As Byte
    Dim corramb(2) As Byte
    Dim ihcore(2) As Byte
    Dim ivcore(2) As Byte
    Dim temp_xoffset As Byte
    Dim temp_yoffset As Byte
    Dim index As Byte
    Dim inphase(5499) As Byte
End Class

الخطأ الذي ذكرته ..غالباً بسبب عدم استخدامك لكلمة New

_template = new BII_Template

و ذلك قبل استدعاءك للدالة.

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

اقتباس
الـ VB هى الأساس ... بتبرمج بيها بالاحساس

ولا سيمي كولن ولا أقواس ... وتعلمها سهل لكل الناس

راكب فيها موتور نفاث ... دي سريعه جدا وباخلاص

الـ VB هى التراث ... للذكور والايناث :D

الـ VB لغة عريقه ... حتى اسأل Anwarica

من ديوان الشاعر السي شاربي "معتز شمس"
#12

يا أخ undo أنا جربت فكرة الكلاس وعند إستدعاء الفنكشن يعطيني هذا الخطأ

Can not marshal parameter #3: The type definition of this type has no layout information.

#13

للأسف ليس لدي خبرة..

لكن سأحاول معك لو أعطيتني ملف الDLL ...

اقتباس
الـ VB هى الأساس ... بتبرمج بيها بالاحساس

ولا سيمي كولن ولا أقواس ... وتعلمها سهل لكل الناس

راكب فيها موتور نفاث ... دي سريعه جدا وباخلاص

الـ VB هى التراث ... للذكور والايناث :D

الـ VB لغة عريقه ... حتى اسأل Anwarica

من ديوان الشاعر السي شاربي "معتز شمس"
#14

للأسف لن يعمل ملف ال dll من غير وجود الجهاز (جهاز البصمة)

هذا الموضوع مغلق.

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