我有一个数组从文本文件中获取其值.每一行都是一个数组值.我试图让每个数组值进入列表框.如
[0] - Hello
[1] - Goodbye
Run Code Online (Sandbox Code Playgroud)
在列表框中,第一个选项是hello,第二个选项是再见等.
文本文件是分开的行上的Hello和Goodbye
继承我的代码从文本文件中排序数组:
StreamReader sr = new StreamReader("text.txt");
int counter = 0;
string line;
string[] linea;
linea = new string[100];
while ((line = sr.ReadLine()) != null)
{
linea[counter] = line;
counter++;
}
sr.Close();
Run Code Online (Sandbox Code Playgroud)
这是我的列表框代码:
this.listBox1.Items.AddRange(new object[] {
// Values go here
// i want the arrays here, so that its like "hello", "goodbye",
});
Run Code Online (Sandbox Code Playgroud)
非常感谢帮助.我正在使用MS Visual Studio 2010.
我将基于浏览器上传的示例YouTube api代码复制并粘贴到我的网站,但是当我将类别更改为"游戏"时,它会显示错误的请求错误.
这是示例代码:
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory('Autos');
// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry->SetVideoTags('cars, funny');
$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
$tokenValue = $tokenArray['token'];
$postUrl = $tokenArray['url'];
Run Code Online (Sandbox Code Playgroud)
但是,当我改变
$myVideoEntry->setVideoCategory('Autos');
Run Code Online (Sandbox Code Playgroud)
至
$myVideoEntry->setVideoCategory('Gaming');
Run Code Online (Sandbox Code Playgroud)
我明白了..
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 <?xml version='1.0' encoding='UTF-8'?><errors><error><domain>yt:validation</domain><code>invalid_value</code><location type='xpath'>media:group/media:category[@scheme='http://gdata.youtube.com/schemas/2007/categories.cat']/text()</location></error></errors> …Run Code Online (Sandbox Code Playgroud) arrays ×1
c# ×1
gdata ×1
gdata-api ×1
listbox ×1
php ×1
streamreader ×1
youtube-api ×1
zend-gdata ×1