Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]一个字符串包含问题

1楼
飞鱼 发表于:2010/10/19 14:33:00

设计了一个窗口,按钮的代码为:

dim s1 as string

dim brand() as string

brand(0)="a"

brand(1)-"b"

For Each dr As DataRow In DataTables("字符转换").Datarows
      s1=dr("转换字符")
      s1=s1.ToLower()
   For Index As Integer = 0 To brand.Length - 1
      If s1.Contains(brand(Index)) Then  

      dr("brand")=brand(index)
      End If
   Next
Next

 

    运行时出现错误:

 

 

    这里面有一句If s1.Contains(brand(Index)) Then ,我想问一下,这样写对不对?


图片点击可在新窗口打开查看此主题相关图片如下:未命名.jpg
图片点击可在新窗口打开查看
[此贴子已经被作者于2010-10-19 14:40:31编辑过]
2楼
狐狸爸爸 发表于:2010/10/19 14:37:00

s1=dr("转换字符") 
s1=s1.ToLower()

 

改一下:

 

if dr.Isnull("转换字符") Then

   continue for

end if

s1=dr("转换字符") 
s1=s1.ToLower()


 

3楼
飞鱼 发表于:2010/10/19 14:40:00
改了,问题一样出现。
4楼
狐狸爸爸 发表于:2010/10/19 14:51:00

别改那个,改这个:

dim brand() as string

改为

dim brand(1) as string

 

5楼
飞鱼 发表于:2010/10/19 15:01:00

解决了。谢谢! 

[此贴子已经被作者于2010-10-19 15:01:48编辑过]
6楼
狐狸爸爸 发表于:2010/10/19 15:03:00

dim brand(2) as string

 

或者缩为一行:

 

Dim brand() as string = {"a", "b"}

共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.