2016-10-26 11 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 и говоритЗначение типа '1-мерный массив байта' не может быть преобразовано в 'String'. Программа введения героев LOL

значение типа «1-мерный массив Byte» не может быть преобразован в «String».

+0

Добро пожаловать в [so], вы можете сначала проверить [ask]. Кроме того, вам может понадобиться предоставить свои ресурсы, мы не будем знать, что такое ваш «Teriffyskill». – Prisoner

ответ

0

Это означает, что свойство Teriffyskill, определенное вами в My.Resources.Resources1, определяется как массив байтов. Если вы хотите присвоить значение строковому значению, например 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 

 Смежные вопросы

  • Нет связанных вопросов^_^