2016-10-26 44 views
-1
Public Class Form1 
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged 

     Select Case ListBox1.SelectedIndex 

      Case 0 
       TextBox1.Text = "For nearly twenty years, Fiddlesticks has stood alone in the easternmost summoning chamber of the Institute of War. Only the burning emerald light of his unearthly gaze pierces the musty darkness of his dust-covered home. It is here that the Harbinger of Doom keeps a silent vigil. His is a cautionary tale of power run amok, taught to all summoners within the League. Decades ago, there existed a powerful rune mage from Zaun - Istvaan. At the end of the fifth Rune War, he became one of the League's first summoners. Too much a prisoner to the old ways of magic, Istvaan stepped further and further outside the rules of conduct in the League. In what was ultimately his last match, his reach finally exceeded his grasp. Sealing himself inside the easternmost summoning chamber, he began incanting the most forbidden of rituals - an extra-planar summoning. What exactly happened inside that chamber remains unknown. No champion came to represent Zaun that day in Summoner's Rift. Only silence echoed back from repeated knocks on the chamber door. The first apprentice who entered was cut down immediately by an unearthly scythe. What few who followed and survived were driven mad by fear, mere husks of men gibbering about crows and death. Afraid of the evil even Istvaan could not control, the League sealed all exits to the chamber, hoping they could contain what they could not destroy. Years went by, but the wooden figure within never moved save to slay any foolish enough to enter. Seeing no recourse to reclaim the chamber, the Council instead devised a use for Fiddlesticks: executioner. While he comes to life and seemingly abides by the rules of summoning in the Fields of Justice, what he awaits inside his chamber is unknown. His unmoving face yields no clues, and his scythe stands ready to strike down any who stand before him. Those who say 'you have nothing to fear but fear itself' have not yet felt the crows." 
       PictureBox1.Image = My.Resources.Resource1.FiddleSticks_0 
       PictureBox2.Image = My.Resources.Resource1.FiddleSticks_8 
       Button1.BackgroundImage = My.Resources.Resource1.Terrify 
       Button2.BackgroundImage = My.Resources.Resource1.Drain 
       Button3.BackgroundImage = My.Resources.Resource1.FiddlesticksDarkWind 
       Button4.BackgroundImage = My.Resources.Resource1.Crowstorm 
      Case 1 
       TextBox1.Text = "The most feared duelist in all Valoran, Fiora is as renowned for her brusque manner and cunning mind as she is for the speed of her bluesteel rapier. Born to House Laurent in the kingdom of Demacia, Fiora took control of the family from her father in the wake of a scandal that nearly destroyed them. House Laurent's reputation was sundered, but Fiora bends her every effort to restore her family's honor and return them to their rightful place among the great and good of Demacia." 
       PictureBox1.Image = My.Resources.Resource1.Fiora_0 
       PictureBox2.Image = My.Resources.Resource1.Fiora_4 
       Button1.BackgroundImage = My.Resources.Resource1.FioraQ 
       Button2.BackgroundImage = My.Resources.Resource1.FioraW 
       Button3.BackgroundImage = My.Resources.Resource1.FioraE 
       Button4.BackgroundImage = My.Resources.Resource1.FioraR 
     End Select 
    End Sub 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
     ListBox1.Items.Add("FiddleSticks") 
     ListBox1.Items.Add("Fiora") 
     ListBox1.Items.Add("Fizz") 
    End Sub 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
     Form2.AxWindowsMediaPlayer1.URL = My.Resources.Resource1.Teriffyskill 
    End Sub 

爲什麼它不起作用?
這是「它」表示 My.Resources.Resource1.Teriffyskill 部分,它說類型「字節的一維數組」的值不能轉換爲「字符串」。引入LOL英雄的計劃

值類型不能被轉換爲「字符串」「字節的1維陣列」。

+0

歡迎來到[so],您可以先查詢[問]。而且,你可能需要提供你的資源,我們不知道你的'Teriffyskill'是什麼。 – Prisoner

回答

0

這意味着您在My.Resources.Resources1中定義的Teriffyskill屬性被定義爲Byte數組。如果您希望能夠將值賦給像Form2.AxWindowsMediaPlayer1.URL這樣的字符串值,那麼您需要將Teriffyskill的定義更改爲字符串,或者在將其分配給URL時將其轉換爲字符串

因此,的

Dim Teriffyskill As Byte() 

你將它定義爲

Dim Teriffyskill as String 

或者你可以在你的Button1的Click處理施放它就像這樣。

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Form2.AxWindowsMediaPlayer1.URL = System.Text.Encoding.UTF8.GetString(My.Resources.Resource1.Teriffyskill) 
End Sub 
相關問題