比如输入一段字母:ATATATAGCGCGCA
点击转换按钮,将其中的A转为T,T转为A,G转为C,C转为G
然后输出到另一个文本框中:TATATACGCGCGT

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim S0 As String
    Dim i As Integer
    Dim S As String
    Dim temp As StringS0 = "ATATATAGCGCGCA"For i = 1 To Len(S0)
      temp = Mid(S0, i, 1)
      Select Case temp
      Case "A"
         temp = "T"
      Case "T"
         temp = "A"
      Case "G"
         temp = "C"
      Case "C"
         temp = "G"
      End Select
     S = S + temp
    NextPrint S0
    Print S
    End Sub
      

  2.   

    出错了,说:S0转为integer无效
      

  3.   

    代码测试过,没问题
    出错一般是变量类型不匹配,
    你参考思路做相应的更改.或直接改为Variant变量.
      

  4.   

    string默认保存long型指针,能用long 就避免用integer
      

  5.   


    Private Sub Command1_Click()
    Dim str1 As Stringstr1 = Replace("ATATATAGCGCGCA", "A", "@")
    str1 = Replace(str1, "T", "A"): str1 = Replace(str1, "@", "T")
    str1 = Replace(str1, "G", "@"): str1 = Replace(str1, "C", "G")
    str1 = Replace(str1, "G", "C")TEXT2.TEXT=STR1
    End Sub
     
      

  6.   

    用replacedim s as string
    s="ATATATAGCGCGCA"
    s=replace(s,"T","A")
    s=replace(s,"C","*")
    s=replace(s,"G","C")
    s=replace(s,"*","G")
      

  7.   

    还是不行啊!!各位。我是想在一个文本框里输入一个ATATTATATATAGCGCGCCGC之类的。这是个例子而已,不一定就输入这个,但是输入的只有ATGC四种单词,顺序随机的,希望出来把其中的A换成T,T换成A,G换成C,C换成G。然后输入到另一个文本框中。
    界面如下
      

  8.   

    能不能帮忙给改改,没怎么学过VB,我replace  A到T,然后replace  T到A ,但是只得到一种替换。
      

  9.   


    Option ExplicitPrivate Function trans(ByVal s0 As String) As String
    Dim i As Integer
    Dim S As String
    Dim temp As StringFor i = 1 To Len(s0)
      temp = Mid(s0, i, 1)
      Select Case temp
      Case "A"
         temp = "T"
      Case "T"
         temp = "A"
      Case "G"
         temp = "C"
      Case "C"
         temp = "G"
      End Select
     S = S + temp
    Next
        trans = S
    End FunctionPrivate Sub Command1_Click()
        Text2.Text = trans(Text1.Text)
    End Sub