<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>在 DataTable 中將 BindingSource.Current 轉換為特定資料列</Title>
      <Author>Microsoft Corporation</Author>
      <Description>取得繫結來源內目前的資料列，並轉換成特定資料列。這是擷取目前資料列時建議使用的方法，不建議使用 BindingSource.Position，因為可能由於 DataView 的排序不同，而傳回不同的資料列</Description>
      <Shortcut>dtBindingSourceCurrent</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Data</Assembly>
        </Reference>
        <Reference>
          <Assembly>System.XML</Assembly>
        </Reference>
      </References>
      <Declarations>
        <Object>
          <ID>rowType</ID>
          <Type>DataRow</Type>
          <ToolTip>取代為您的資料集中 DataRow 的類型</ToolTip>
          <Default>NorthwindDataSet.CustomersRow</Default>
        </Object>
        <Object>
          <ID>bindingSource</ID>
          <Type>BindingSource</Type>
          <ToolTip>取代為要擷取其中資料列的 BindingSource</ToolTip>
          <Default>CustomersBindingSource</Default>
        </Object>
      </Declarations>
      <Code Language="VB"><![CDATA[Dim row As $rowType$
row = CType(CType(Me.$bindingSource$.Current, DataRowView).Row, $rowType$)
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
