tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル 度々すみません
投稿日: 2005/01/26(Wed) 16:02
投稿者さち
こういうことなのかと思って
↓のようなコードを書いたのですが
やっぱりダメでした。
mComboBoxes(0) = comboBox1
の一文のcomboBox1は代入されていないのでしょうか?
下記のようなメッセージが出たのですがお気づきの点など
ありましたら教えてください。よろしくお願いします。


Sub MakingXml()    
    Dim mComboBoxes() As ComboBox
        mComboBoxes(0) = comboBox1
        mComboBoxes(1) = comboBox2
        mComboBoxes(2) = comboBox3
    mComboBoxes(3) = comboBox4
    mComboBoxes(4) = comboBox5
    mComboBoxes(5) = comboBox6
    mComboBoxes(6) = comboBox7
    mComboBoxes(7) = comboBox8
    mComboBoxes(8) = comboBox9
    mComboBoxes(9) = comboBox10
    mComboBoxes(10) = comboBox11
    mComboBoxes(11) = comboBox12
    mComboBoxes(12) = comboBox13
    mComboBoxes(13) = comboBox14
    mComboBoxes(14) = comboBox15

    Dim mtextBoxes() As textBox      
        mtextBoxes(0) = textBox1
        mtextBoxes(1) = textBox2
        mtextBoxes(2) = textBox3
    mtextBoxes(3) = textBox4
    mtextBoxes(4) = textBox5
    mtextBoxes(5) = textBox6
    mtextBoxes(6) = textBox7
    mtextBoxes(7) = textBox8
    mtextBoxes(8) = textBox9
    mtextBoxes(9) = textBox10
    mtextBoxes(10) = textBox11
    mtextBoxes(11) = textBox12
    mtextBoxes(12) = textBox13
    mtextBoxes(13) = textBox14
    mtextBoxes(14) = textBox15
        
    Dim xWriter As XmlTextWriter                

    xWriter = New XmlTextWriter("sorce/appli.xml", System.Text.Encoding.GetEncod
ing
("Shift_jis"))
    With xWriter
    .Formatting = Formatting.Indented
    .Indentation = 3
    .WriteProcessingInstruction("xml", "version='1.0' encoding='Shift_jis'&
quot;)
                    
     .WriteStartElement("A")
                        
     .WriteStartElement("B")
     .WriteString(textBox1.Text)                        
                    
    Dim i As Integer
    For i = 1 To 15
    .WriteStartElement(mComboBoxes(i).Text)
    .WriteString(mtextBoxes(i).Text)
    .WriteEndElement()
    Next i
                        
    .WriteEndElement()
    .WriteEndElement()                                
                            
    .Flush()
    .Close()
     End With    
                  
End Sub

************** 例外テキスト **************
System.NullReferenceException: オブジェクト参照がオブジェクト インスタンスに設定されていませ
ん。
at register.MainForm.MakingXml() in C:\My Documents\SharpDevelop
Projects\register\MainForm.vb:line 608

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。