منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
مشكلة في طريقة كود - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : مشكلة في طريقة كود (/showthread.php?tid=7935)

الصفحات: 1 2 3 4 5


مشكلة في طريقة كود - سعود - 13-03-13

عندي 2012 ولا ادري ليه قليل استخدمهSmile جربت عليه ونفس الحكاية بس الغريب انه ماطلب ترقية للمشروع المعمول بـ 2010


مشكلة في طريقة كود - Easy4ever - 13-03-13

ممكن أشتغل 2010 بإحتضان إيطار 2012 > تسويها ميكروسوفت مو بعيده عنها !


مشكلة في طريقة كود - shado1796 - 13-03-13

[COLOR="#0000CD"]اسف على الرد المتأخر ،،،
معقوله ما ضبط ،، يعني مصيري الى البارومترات ،،، بس المشكلة انا حاولت احول اكوادي للبارومترات لكن تظهر لي اخطاء ،، لكن اذا ازلت انا امر اضافت الصور يزول الخطأ ،، عموما الخطأ هذا هو ..
Arithmetic operation resulted in an overflow
ما الحل ؟
طبعا هذا هو االكود بعد تحويلي في مشروعي الاساسي وليس المثال الذي ارفقته ،، ارجوا رؤيته لانه يظهر String ."


كود :
Dim picStream As New MemoryStream

        PictureBox2.Image.Save(picStream, ImageFormat.Gif)
        PictureBox3.Image.Save(picStream, ImageFormat.Gif)
        PictureBox4.Image.Save(picStream, ImageFormat.Gif)
        PictureBox5.Image.Save(picStream, ImageFormat.Gif)
        PictureBox6.Image.Save(picStream, ImageFormat.Gif)
        PictureBox7.Image.Save(picStream, ImageFormat.Gif)
        PictureBox8.Image.Save(picStream, ImageFormat.Gif)
        PictureBox9.Image.Save(picStream, ImageFormat.Gif)
        PictureBox10.Image.Save(picStream, ImageFormat.Gif)
        PictureBox11.Image.Save(picStream, ImageFormat.Gif)
        PictureBox12.Image.Save(picStream, ImageFormat.Gif)
        PictureBox13.Image.Save(picStream, ImageFormat.Gif)


        Dim PicByte As Byte() = picStream.ToArray
        Dim cm As New SqlCommand("insert into Table1 (UserName,MobileNumber,Date,Price,Rest,Recipient,NameShop,PlaceShop,UserShop,Email,NumberDresses,ColorDress1,TypeCloth1,TypeDesign1,TypePocket1,IDCloth1,LengthM1,LengthY1,ColorDress2,TypeCloth2,TypeDesign2,TypePocket2,IDCloth2,LengthM2,LengthY2,ColorDress3,TypeCloth3,TypeDesign3,TypePocket3,IDCloth3,LengthM3,LengthY3,LengthDress,DisplayKtf,DisplayDress,LengthKmSadh,LengthKmKbk,DisplayKmSadh1,DisplayKmSadh2,DisplayKmSadh3,DisplayKmKbk1,DisplayKmKbk2,DisplayKmKbk3,RakbhKllab1,RakbhKllab2,RakbhSadh1,RakbhSadh2,DownDress1,DownDress2,LengthKbzor,Other,Img1U1,Img2U1,Img3U1,Img4U1,Img1U2,Img2U2,Img3U2,Img4U2,Img1U3,Img2U3,Img3U3,Img4U3) values (@UserName,@MobileNumber,@Date,@Price,@Rest,@Recipient,@NameShop,@PlaceShop,@UserShop,@Email,@NumberDresses,@ColorDress1,@TypeCloth1,@TypeDesign1,@TypePocket1,@IDCloth1,@LengthM1,@LengthY1,@ColorDress2,@TypeCloth2,@TypeDesign2,@TypePocket2,@IDCloth2,@LengthM2,@LengthY2,@ColorDress3,@TypeCloth3,@TypeDesign3,@TypePocket3,@IDCloth3,@LengthM3,@LengthY3,@LengthDress,@DisplayKtf,@DisplayDress,@LengthKmSadh,@LengthKmKbk,@DisplayKmSadh1,@DisplayKmSadh2,@DisplayKmSadh3,@DisplayKmKbk1,@DisplayKmKbk2,@DisplayKmKbk3,@RakbhKllab1,@RakbhKllab2,@RakbhSadh1,@RakbhSadh2,@DownDress1,@DownDress2,@LengthKbzor,@Other,@Img1U1,@Img2U1,@Img3U1,@Img4U1,@Img1U2,@Img2U2,@Img3U2,@Img4U2,@Img1U3,@Img2U3,@Img3U3,@Img4U3)", Conn)
        cm.Parameters.AddWithValue("@UserName", SqlDbType.VarChar).Value = (TextBox1.Text).ToString
        cm.Parameters.AddWithValue("@MobileNumber", SqlDbType.Int).Value = CInt(TextBox2.Text).ToString
        cm.Parameters.AddWithValue("@Date", SqlDbType.Date).Value = CDate(TextBox7.Text).ToString
        cm.Parameters.AddWithValue("@Price", SqlDbType.Int).Value = CInt(TextBox45.Text).ToString
        cm.Parameters.AddWithValue("@Rest", SqlDbType.Int).Value = CInt(TextBox46.Text).ToString
        cm.Parameters.AddWithValue("@Recipient", SqlDbType.Int).Value = CInt(TextBox47.Text).ToString
        cm.Parameters.AddWithValue("@NameShop", SqlDbType.VarChar).Value = (TextBox4.Text).ToString
        cm.Parameters.AddWithValue("@PlaceShop", SqlDbType.VarChar).Value = (TextBox5.Text).ToString
        cm.Parameters.AddWithValue("@UserShop", SqlDbType.VarChar).Value = (TextBox6.Text).ToString
        cm.Parameters.AddWithValue("@Email", SqlDbType.VarChar).Value = (TextBox3.Text).ToString
        cm.Parameters.AddWithValue("@NumberDresses", SqlDbType.Int).Value = CInt(TextBox71.Text).ToString
        cm.Parameters.AddWithValue("@ColorDress1", SqlDbType.VarChar).Value = (TextBox8.Text).ToString
        cm.Parameters.AddWithValue("@TypeCloth1", SqlDbType.VarChar).Value = (TextBox9.Text).ToString
        cm.Parameters.AddWithValue("@TypeDesign1", SqlDbType.VarChar).Value = (TextBox10.Text).ToString
        cm.Parameters.AddWithValue("@TypePocket1", SqlDbType.VarChar).Value = (TextBox11.Text).ToString
        cm.Parameters.AddWithValue("@IDCloth1", SqlDbType.Int).Value = CInt(TextBox20.Text).ToString
        cm.Parameters.AddWithValue("@LengthM1", SqlDbType.VarChar).Value = (TextBox21.Text).ToString
        cm.Parameters.AddWithValue("@LengthY1", SqlDbType.VarChar).Value = (TextBox87.Text).ToString
        cm.Parameters.AddWithValue("@ColorDress2", SqlDbType.VarChar).Value = (TextBox15.Text).ToString
        cm.Parameters.AddWithValue("@TypeCloth2", SqlDbType.VarChar).Value = (TextBox14.Text).ToString
        cm.Parameters.AddWithValue("@TypeDesign2", SqlDbType.VarChar).Value = (TextBox13.Text).ToString
        cm.Parameters.AddWithValue("@TypePocket2", SqlDbType.VarChar).Value = (TextBox12.Text).ToString
        cm.Parameters.AddWithValue("@IDCloth2", SqlDbType.Int).Value = CInt(TextBox22.Text).ToString
        cm.Parameters.AddWithValue("@LengthM2", SqlDbType.VarChar).Value = (TextBox23.Text).ToString
        cm.Parameters.AddWithValue("@LengthY2", SqlDbType.VarChar).Value = (TextBox88.Text).ToString
        cm.Parameters.AddWithValue("@ColorDress3", SqlDbType.VarChar).Value = (TextBox19.Text).ToString
        cm.Parameters.AddWithValue("@TypeCloth3", SqlDbType.VarChar).Value = (TextBox18.Text).ToString
        cm.Parameters.AddWithValue("@TypeDesign3", SqlDbType.VarChar).Value = (TextBox17.Text).ToString
        cm.Parameters.AddWithValue("@TypePocket3", SqlDbType.VarChar).Value = (TextBox16.Text).ToString
        cm.Parameters.AddWithValue("@IDCloth3", SqlDbType.Int).Value = CInt(TextBox24.Text).ToString
        cm.Parameters.AddWithValue("@LengthM3", SqlDbType.VarChar).Value = (TextBox25.Text).ToString
        cm.Parameters.AddWithValue("@LengthY3", SqlDbType.VarChar).Value = (TextBox89.Text).ToString
        cm.Parameters.AddWithValue("@LengthDress", SqlDbType.VarChar).Value = (TextBox26.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKtf", SqlDbType.VarChar).Value = (TextBox27.Text).ToString
        cm.Parameters.AddWithValue("@DisplayDress", SqlDbType.VarChar).Value = (TextBox28.Text).ToString
        cm.Parameters.AddWithValue("@LengthKmSadh", SqlDbType.VarChar).Value = (TextBox29.Text).ToString
        cm.Parameters.AddWithValue("@LengthKmKbk", SqlDbType.VarChar).Value = (TextBox30.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmSadh1", SqlDbType.VarChar).Value = (TextBox31.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmSadh2", SqlDbType.VarChar).Value = (TextBox32.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmSadh3", SqlDbType.VarChar).Value = (TextBox33.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmKbk1", SqlDbType.VarChar).Value = (TextBox34.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmKbk2", SqlDbType.VarChar).Value = (TextBox35.Text).ToString
        cm.Parameters.AddWithValue("@DisplayKmKbk3", SqlDbType.VarChar).Value = (TextBox36.Text).ToString
        cm.Parameters.AddWithValue("@RakbhKllab1", SqlDbType.VarChar).Value = (TextBox37.Text).ToString
        cm.Parameters.AddWithValue("@RakbhKllab2", SqlDbType.VarChar).Value = (TextBox39.Text).ToString
        cm.Parameters.AddWithValue("@RakbhSadh1", SqlDbType.VarChar).Value = (TextBox40.Text).ToString
        cm.Parameters.AddWithValue("@RakbhSadh2", SqlDbType.VarChar).Value = (TextBox41.Text).ToString
        cm.Parameters.AddWithValue("@DownDress1", SqlDbType.VarChar).Value = (TextBox42.Text).ToString
        cm.Parameters.AddWithValue("@DownDress2", SqlDbType.VarChar).Value = (TextBox43.Text).ToString
        cm.Parameters.AddWithValue("@LengthKbzor", SqlDbType.VarChar).Value = (TextBox44.Text).ToString
        cm.Parameters.AddWithValue("@Other", SqlDbType.VarChar).Value = (TextBox38.Text).ToString



        cm.Parameters.AddWithValue("@Img1U1", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img2U1", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img3U1", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img4U1", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img1U2", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img2U2", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img3U2", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img4U2", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img1U3", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img2U3", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img3U3", SqlDbType.VarBinary).Value = PicByte
        cm.Parameters.AddWithValue("@Img4U3", SqlDbType.VarBinary).Value = PicByte


        If Conn.State = ConnectionState.Closed Then
            Conn.Open()
        End If
        cm.ExecuteNonQuery()

        Me.RefreshListView()


وهذا امر تحديث وجلب المعلومات الى Listview لانه ممكن يكون السبب لانه في الكود السابق يوجد امر Me.RefreshListView() وهو مرتب بالكود التالي :

كود :
'  تعريف تحديث اللسته للتفصيل
    Sub RefreshListView()
        'Fill the Grid
        ListView1.Items.Clear()
        Dim ds As New DataSet("Table1")
        Dim dt As New DataTable()
        Dim sqladp As New SqlDataAdapter("SELECT * FROM Table1", Conn)
        sqladp.Fill(ds, "Table1")
        dt = ds.Tables("Table1")
        Dim pos As Integer
        For pos = 0 To dt.Rows.Count - 1
            Dim item As New ListViewItem()
            item.Text = dt.Rows(pos)("ID").ToString()
            item.SubItems.Add(dt.Rows(pos)("UserName").ToString())
            item.SubItems.Add(dt.Rows(pos)("MobileNumber")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Date")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Price")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Rest")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Recipient")).ToString()
            item.SubItems.Add(dt.Rows(pos)("NameShop")).ToString()
            item.SubItems.Add(dt.Rows(pos)("PlaceShop")).ToString()
            item.SubItems.Add(dt.Rows(pos)("UserShop")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Email")).ToString()
            item.SubItems.Add(dt.Rows(pos)("NumberDresses")).ToString()
            item.SubItems.Add(dt.Rows(pos)("ColorDress1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeCloth1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeDesign1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypePocket1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("IDCloth1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthM1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthY1")).ToString()

            item.SubItems.Add(dt.Rows(pos)("ColorDress2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeCloth2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeDesign2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypePocket2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("IDCloth2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthM2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthY2")).ToString()


            item.SubItems.Add(dt.Rows(pos)("ColorDress3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeCloth3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypeDesign3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("TypePocket3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("IDCloth3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthM3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthY3")).ToString()


            item.SubItems.Add(dt.Rows(pos)("LengthDress")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKtf")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayDress")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthKmSadh")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthKmKbk")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmSadh1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmSadh2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmSadh3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmKbk1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmKbk2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DisplayKmKbk3")).ToString()
            item.SubItems.Add(dt.Rows(pos)("RakbhKllab1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("RakbhKllab2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("RakbhSadh1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("RakbhSadh2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DownDress1")).ToString()
            item.SubItems.Add(dt.Rows(pos)("DownDress2")).ToString()
            item.SubItems.Add(dt.Rows(pos)("LengthKbzor")).ToString()
            item.SubItems.Add(dt.Rows(pos)("Other")).ToString()


            ListView1.Items.Add(item)
        Next pos
        Conn.Close()
    End Sub

[/COLOR]



مشكلة في طريقة كود - Sajad - 13-03-13

[COLOR="#A52A2A"]السلام عليكم

انظر الى هذا الكود

PHP كود :
Dim SavCom As New SqlCommand


        With SavCom
            
.Connection Cn
            
.CommandType CommandType.Text
            
.CommandText "insert into TB (Stock, CostPrice,TotalSales,Profit,Photo) values(?, ?, ?, ?, ?)"
            
.Parameters.Clear()
            .
Parameters.AddWithValue("@Stock"OleDbType.VarChar).Value TextBox1.Text.Trim
            
.Parameters.AddWithValue("@CostPrice"OleDbType.Integer).Value TextBox2.Text.Trim
            
.Parameters.AddWithValue("@TotalSales"OleDbType.Integer).Value TextBox3.Text.Trim
            
.Parameters.AddWithValue("@Profit"OleDbType.Integer).Value Val(Val(TextBox3.Text.Trim) - Val(TextBox2.Text.Trim))
            .
Parameters.AddWithValue("@Photo"OleDbType.Binary).Value BB
        End With

        Cn
.Open()
        
SavCom.ExecuteNonQuery()
        
Cn.Close() 

هكذا تستخدم الباراميترات اخي العزيز حاول ان تستفيد من الكود للاخ ابو ايهاب[/COLOR]



مشكلة في طريقة كود - shado1796 - 13-03-13

بالنسبة لكود ابو ايهاب راح اجربه الحين بنفس طريقته ،،
اما الان حبيت اقولكم انه ضاف الصور بالبارومترات Big Grin Big Grin لكككن اذا جئت استخرج البيانات من اداة Listview تظهر مشكلة واكتشفت سببها وهي من هذا الكود
،، اذا مسحته ذهب الخطأ ،، لكن لا يمكني ان امسحه لانه هو كود استخراج الصور :eek: ( انا وضعت الكود في حدث DoubleClick )

كود :
PictureBox2.DataBindings.Add("image", ds, "Table1.Img1U1", True).ToString()
        PictureBox3.DataBindings.Add("image", ds, "Table1.Img2U1", True).ToString()
        PictureBox4.DataBindings.Add("image", ds, "Table1.Img3U1", True).ToString()
        PictureBox5.DataBindings.Add("image", ds, "Table1.Img4U1", True).ToString()
        '
        PictureBox6.DataBindings.Add("image", ds, "Table1.Img1U2", True).ToString()
        PictureBox7.DataBindings.Add("image", ds, "Table1.Img2U2", True).ToString()
        PictureBox8.DataBindings.Add("image", ds, "Table1.Img3U2", True).ToString()
        PictureBox9.DataBindings.Add("image", ds, "Table1.Img4U2", True).ToString()
        '
        PictureBox10.DataBindings.Add("image", ds, "Table1.Img1U3", True).ToString()
        PictureBox11.DataBindings.Add("image", ds, "Table1.Img2U3", True).ToString()
        PictureBox12.DataBindings.Add("image", ds, "Table1.Img3U3", True).ToString()
        PictureBox13.DataBindings.Add("image", ds, "Table1.Img4U3", True).ToString()


وهذه صورة المشكلة
http://im32.gulfup.com/hFYw7.png




مشكلة في طريقة كود - Sajad - 13-03-13

[COLOR="#A52A2A"]السلام عليكم

اخي العزيز امسح الToString ثم جرب[/COLOR]



مشكلة في طريقة كود - shado1796 - 13-03-13

sajad كتب :[COLOR="#A52A2A"]السلام عليكم

اخي العزيز امسح الToString ثم جرب[/COLOR]
[COLOR="#FF0000"]

[b][SIZE=4][COLOR="#FF0000"]
شكرا اخي ،، تم ازالة المشكلة ،، لكن ظهرت مشكلة ثانيه ،، كل الصور نفس الصورة مع ان كود الاضافة والاستخراج مختلف الاكواد ،،كما هو موضح في الاكواد الموجودة في المشاركة السابقة لي SadSad:eek: لاحظ الصورة تبين المشكلة
http://im33.gulfup.com/KQkmc.png
[/COLOR][/COLOR][/SIZE][/b]


مشكلة في طريقة كود - shado1796 - 13-03-13

Up Up Up Up


مشكلة في طريقة كود - سعود - 14-03-13

إقتباس :
كل الصور نفس الصورة
هذا بسبب تكرار نفس المتغير picbyte لكل اعمدة الصور فطبيعي ان تتكرر


مشكلة في طريقة كود - shado1796 - 14-03-13

سعود كتب :هذا بسبب تكرار نفس المتغير picbyte لكل اعمدة الصور فطبيعي ان تتكرر
[b]
غيرت متغيرات لكن هذه لم اغيرها ،، لوجد اكثر من متغير غيرتهم ،، وحبيت اقولك انه حلللت المشكلللله Big Grin Big Grin Big Grin Big Grin
لكككن ما ادري وش المشاكل الي ما توقف ،،، :confused: :confused: ،،، الان المشكلة اذا فتحت شخص من المضافيين في Listview يعمل
لكن اذا جئت افتحه مره ثانيه يظهر لي هذه الرسالة http://im32.gulfup.com/hFYw7.png
[/b]