c# - 如何拆分列表框中的第一行并将其复制到c#中的webbrowser1 elemnt
问题描述
c#拆分listbox1中的第一行并复制“|”之前的行 然后将其粘贴到 webbrowser1 元素和第二个,第三个
listbox1 中的元素如下所示:1111111|88|8888|888|
第一步复制 1111111 然后将其传递到 getElemtby id 将其传递到此 id 输入
第二步复制第二个 88,如果它是相等的,把它按 id 放在 webbrowser1 元素中,比如月 01 到 12
webBrowser1.Document.GetElementById("month").SetAttribute("selectedIndex", "1");
第三步复制第三个 8888,如果相等,将其按 id 放入 webbrowser1 元素中,如 2018 年至 2029 年
如果它喜欢 2018 年
webBrowser1.Document.GetElementById("year").SetAttribute("selectedIndex", "1");
第三步将四个888复制并粘贴到webbrowser1中的id中
逐行执行这些步骤,直到长度 listbox1 结束
然后单击元素我在下面尝试了这个
workwebBrowser1.Document.GetElementById("ys_primary").InvokeMember("click");
然后检查 webbrowser1 中的下一页是否像复制任何项目 ID 一样处理它
解决方案
// here is the solution
string str = listBox1.Items[0].ToString();
char[] b = new char[str.Length];
using (StringReader sr = new StringReader(str))
{
// Read 16 characters from the string into the array.
sr.Read(b, 0, 16);
// to show the result print
string output = string.Join("", b);
MessageBox.Show(output);
// but what if i want to read from 5 to 9
// it does not resolve yet!
推荐阅读
- tensorflow - 即使训练精度很高,CNN 模型也无法对水果图像进行分类
- swift - 从框架添加时视图对操作没有响应
- angular - 从 angular 中的 http.get() 调用返回的数据中获取特定字段
- node.js - 重构后 Express JS Multer 异步无法正常工作
- mysql - 如何在 ubuntu18 中将 lower_case_table_names=1 恢复为 lower_case_table_names=0(默认)
- tensorflow - 损失函数包装在 keras 中工作,但不适用于 tf.keras
- node.js - Sequelize - 使用自定义 where 获取所有数据
- python - Pandas_Unable 将所有行写入 Excel 工作表
- javascript - Eslint + Prettier + React。道具缩进
- javascript - 将数据添加到外部 javascript 文件中的数组