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

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

الصفحات: 1 2


RE: اريد كود للبحث التلقائي في DataGridView - ahmedbezia - 16-11-17

السلام عليكم يا اخوان ان لحد الان لم اجد الحل
ارجو من احد الاخو انوايمر ويعمل تعديل علي هد المثال المرفق
id ويكون البحث ضمن حقل 
[b][attachment=16143][attachment=16143][/b]

(15-11-17, 08:25 PM)Rabeea Qbaha كتب : صديقي المثال شغال 100% و انا قمت بعمله قبل عده ايام لشخص هنا بالمنتدى
قم بالتعديل عليه بشكل مناسب او قم بتشغيل المثال

السلام عليكم يا اخي ان لحد الان لم اجد الحل

ارجو منك  تعديل علي هد المثال المرفق

id ويكون البحث ضمن حقل 

[b] 
   WindowsApplication2.rar (الحجم : 153.33 ك ب / التحميلات : 0) 
   WindowsApplication2.rar (الحجم : 153.33 ك ب / التحميلات : 0) 
[/b]



RE: اريد كود للبحث التلقائي في DataGridView - a.ahmed - 16-11-17

(16-11-17, 01:13 PM)ahmedbezia كتب : لان Target CPU: x86 عندي لايضه اختيارات

< Tools
< Options
< Project and Solutions
< General
Show advanced build configuration: Checked



WindowsApplication2.vbproj
PHP كود :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{04BA54C4-608B-42D6-959B-C62A7B8D28FA}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <StartupObject>WindowsApplication1.My.MyApplication</StartupObject>
    <RootNamespace>WindowsApplication1</RootNamespace>
    <AssemblyName>WindowsApplication2</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>WindowsForms</MyType>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>WindowsApplication2.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DocumentationFile>WindowsApplication2.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Drawing" />
    <Import Include="System.Diagnostics" />
    <Import Include="System.Windows.Forms" />
    <Import Include="System.Linq" />
    <Import Include="System.Xml.Linq" />
    <Import Include="System.Threading.Tasks" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Form1.vb">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.vb">
      <DependentUpon>Form1.vb</DependentUpon>
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Module1.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.vb</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project> 



RE: اريد كود للبحث التلقائي في DataGridView - tryold - 16-11-17

تفضل اخي هذا المثال


RE: اريد كود للبحث التلقائي في DataGridView - Rabeea Qbaha - 16-11-17

قمت بعمل المثال وقمت باضافته الى قسم المشاريع الجاهزه تفضل :
http://vb4arb.com/vb/showthread.php?tid=22581&pid=109602#pid109602


RE: اريد كود للبحث التلقائي في DataGridView - ahmedbezia - 16-11-17

(16-11-17, 05:27 PM)tryold كتب : تفضل اخي هذا المثال

بارك الله فيك اخي مشكور تمام 
لاكن كيف اربط حقل ايدي با قاعدة البينات لان الحقل لايضهر ناتج البحث 
اي انو غير مربوط با قاعدة البينات ارجو الاجابة بارك الله فيك واسف علي الازعاج
Blush
Imports System.Data.OleDb
Imports System.Data
Public Class Form1


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim CnString As String = "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\data.mdb;user id=admin;jet oledb:database password=987"
        Dim Conn As New OleDbConnection(CnString)
        conn = New OleDb.OleDbConnection(str)
    End Sub

    Private Sub DataGridView1_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        Dim itemName As String = DataGridView1.CurrentRow.Cells(0).Value

        If e.ColumnIndex = 0 Then
            'فحص الاتصال بقاعدة البيانات
            If conn.State = ConnectionState.Open Then
                conn.Close()
            End If
            conn.Open()
            Dim cmd As New OleDbCommand()
            cmd.Connection = conn

            cmd.CommandText = "select * from sila where itemName =@itemName"
            cmd.Parameters.AddWithValue("@itemName ", itemName)

            Dim dr As OleDbDataReader = cmd.ExecuteReader
            While dr.Read
                DataGridView1.CurrentRow.Cells(1).Value = dr.Item(1)
                DataGridView1.CurrentRow.Cells(2).Value = dr.Item(2)
                DataGridView1.CurrentRow.Cells(3).Value = dr.Item(3)
                DataGridView1.CurrentRow.Cells(4).Value = dr.Item(4)
                DataGridView1.CurrentRow.Cells(5).Value = dr.Item(5)
            End While

            dr.Close()
            conn.Close()
        End If

      
    End Sub
اين الخطئ هنا