当我遇到这个文档时,我最近正在查找如何打开文件浏览器对话框.现在,看一下这个例子,它显示:
if(openFileDialog1.ShowDialog() == DialogResult.OK)
Run Code Online (Sandbox Code Playgroud)
但是,如果我输入,Intellisense不会识别OK.事实上,它甚至不是一个选择.我不得不使用:
if(openFileDialog1.ShowDialog() == true)
Run Code Online (Sandbox Code Playgroud)
我错过了一些愚蠢的东西,或者这是文档中的疏忽?
我有这个项目,我正在研究它,它在不同的浏览器中显示不同(想象一下).CSS在我尝试过的每个浏览器(chrome,safari,firefox)中运行良好,除了IE11(再次,想象一下).这是IE版本的图片:

这是它应该是什么样子:

现在,我已经浏览了Chrome和IE上的开发工具,结果如下.
IE:

铬:

所以,你可以在图片中看到,在IE浏览器中,bwizard-steps button::before并且bwizard-steps button::after都标出来,但他们却为打算使用Chrome.
任何想法为什么会这样?我查了一下,IE11应该支持::before和::after标签.但它显然无视它们.我甚至尝试进入IE的兼容模式,这看起来更糟糕.
好的,我的代码目前是:
public MySqlDataReader CreateQuery(string queryString, string connectionString )
{
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
using (MySqlCommand command = new MySqlCommand(queryString, connection))
{
command.Connection.Open();
command.ExecuteNonQuery();
MySqlDataReader reader = command.ExecuteReader();
return reader;
}
}
}
Run Code Online (Sandbox Code Playgroud)
在另一个函数中,我有:
using(MySqlDataReader readers = _connection.CreateQuery(query, connectString))
Run Code Online (Sandbox Code Playgroud)
目前,在这种形式下,当我将 reader 返回到 reader 时,没有任何价值。我已经完成了检查,并验证了在返回时,读者中包含正确的信息。然而读者没有价值观。我可能错过了一些完全愚蠢的东西。但我们将不胜感激。谢谢!
好的,我前几天问了这个问题,因为我的模糊性而关闭了.我会尝试更具体.在一个项目中,比如C#(使用Visual Studio),我添加对dll的引用(右键单击References-> Add Reference),并且所述dll的位置在C:\ Blah\Foo中.现在,如果我将构建的exe移动到另一台机器上,那么dll的位置是否需要与exe一起使用,还是需要在C:\ Blah\Foo中?谢谢.
我正在为我工作的公司编写一个C#程序,它将启动一个创建PDF的PHP脚本,然后打开PDF文件.现在,我有:
// launch the PHP page to generate my pdf report
Process.Start(phpFile);
// wait for the report to exist
Thread.Sleep(waitTime);
// open the report
Process.Start(filePath);
Run Code Online (Sandbox Code Playgroud)
现在,我不是一个整体的粉丝" Sleep()在指定的时间内希望文件存在时完成".所以我的问题是,使用do循环是否可行/更好并说:
do
{
// Do nothing until the file exists
} while (!File.Exists(filePath));
Run Code Online (Sandbox Code Playgroud) 我在VS2010中编写的这个项目是一个WinForms项目.我不是在VS2012中将其作为WPF项目编写的.我有一个引用的DLL(DailyReport).里面DailyReport是一个叫做的方法GetUniqueDates().它看起来像这样:
public List<string> GetUniquesDates()
{
var dates = new List<string>();
const string query = "SELECT date FROM hdd_local_data_v1_2";
try
{
// Exception here on the connection creation
using (var connection = new SqlConnection(ConnectionStringFile))
{
using (var command = new SqlCommand(query, connection))
{
connection.Open();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
for (var i = 0; i < reader.FieldCount; i++)
{
dates.Add(reader.GetValue(i).ToString());
}
}
}
}
}
}
catch (Exception ex)
{
Logger.Error(ex.Message); …Run Code Online (Sandbox Code Playgroud) 我正在尝试将json字符串传递给JS,但我遇到的问题是,有时会出现撇号.
function GetHTML( $character )
{
$json = json_encode( $character );
$html = '<div class="linkWindow">'; // links window
$html .= '<div class="links">'; // links
$html .= "<span onclick='LoadWeaponWindow(" . $json . ")'>WEAPON</span><br><br>";
$html .= "<span onclick='LoadArmorWindow(" . $json . ")'>ARMOR</span><br><br>";
$html .= '</div>'; // end links
$html .= '</div>'; // end links window
return $html;
}
Run Code Online (Sandbox Code Playgroud)
此时,$ json具有以下内容:
{"name":"Prayos Drakebane","server":"Sargatanas","lastSynced":"2017-11-27 06:42:01","id":1395894,"title":"Finder of False Gods","hp":31966,"mp":15480,"tp":1000,"strength":134,"dexterity":292,"vitality":1603,"intelligence":2343,"mind":219,"level":70,"eightBitImage":"\/images\/black_mage.png","job":"Black Mage","mainHand":"Palladium Staff","mainHandIcon":"https:\/\/img.finalfantasyxiv.com\/lds\/pc\/global\/images\/itemicon\/66\/661be0dedb391b0dc47e3d8adaec13936b6fc8b7.png?20171121","mainHandLink":"https:\/\/na.finalfantasyxiv.com\/lodestone\/playguide\/db\/item\/ddade11374b","head":"True Griffin Hat of Casting","headIcon":"https:\/\/img.finalfantasyxiv.com\/lds\/pc\/global\/images\/itemicon\/f5\/f53642ff6b75927a0697c61022f034257a0de23f.png?20171121","headLink":"https:\/\/na.finalfantasyxiv.com\/lodestone\/playguide\/db\/item\/fa1281f7e98","body":"Augmented Lost Allagan Coat of Casting","bodyIcon":"https:\/\/img.finalfantasyxiv.com\/lds\/pc\/global\/images\/itemicon\/7a\/7a0c7232f4d31e431b5a67478572913f95c63518.png?20171121","bodyLink":"https:\/\/na.finalfantasyxiv.com\/lodestone\/playguide\/db\/item\/c271ddd702d","hands":"Ivalician Enchanter's Gloves","handsIcon":"https:\/\/img.finalfantasyxiv.com\/lds\/pc\/global\/images\/itemicon\/a5\/a514dd4fd3c966246b4e05b3ac6e628f14a2fe56.png?20171121","handsLink":"https:\/\/na.finalfantasyxiv.com\/lodestone\/playguide\/db\/item\/b5259d4ef69","waist":"Ivalician Enchanter's Belt","waistIcon":"https:\/\/img.finalfantasyxiv.com\/lds\/pc\/global\/images\/itemicon\/90\/90a4d2a95b62c557c675a5363d2f8cacfda91067.png?20171121","waistLink":"https:\/\/na.finalfantasyxiv.com\/lodestone\/playguide\/db\/item\/c668efaf693","legs":"Indigo Ramie …Run Code Online (Sandbox Code Playgroud) 所以,我遇到了一个问题,我最喜欢的广播电台在我开车时播放一首我不认识的歌.他们没有一个页面显示他们播放的歌曲列表; 然而,他们在他们的网站上有一个"正在播放"部分,显示当前正在播放的内容和由谁播放.所以,我正在尝试编写一个小程序,它会在2分钟内浏览网站,以检索歌曲和艺术家的名字.使用Chrome开发工具,我可以在源代码中看到歌曲标题和艺术家.但是当我查看页面源时,它并没有显示出来.他们正在使用javascript来运行显示该信息.我尝试过以下方法:
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(@"http://www.thebuzz.com/main.html");
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
do
{
// Do nothing while we wait for the page to load
}
while (webBrowser1.ReadyState == WebBrowserReadyState.Loading);
var test = webBrowser1.DocumentText;
textBox1.Text = test.ToString();
}
Run Code Online (Sandbox Code Playgroud)
从本质上讲,我正在加载它WebBrowser并尝试以这种方式获取源代码.但是在javascript运行之后我还没有得到它.有没有办法在事实之后实际检索呈现的HTML?
编辑
另外,有一种方法WebBrowser允许脚本运行吗?我得到弹出窗口询问我是否要允许它们运行.我不想压制它们,我需要它们来运行.
我有一个对象属性DateTime Date.我试图把它作为一个DateTime对象,但只显示日期,即9/30/2013.我不想使用ToString()或ToShortDateString().我尝试过使用Date.Date,但这仍然显示日期和时间.有没有办法查看DateTime未将其转换为字符串的日期?
我也读过这个问题.这个问题按我喜欢的方式措辞,但答案仍然使用了ToShortDateString().
这将显示在DataGrid绑定到我的对象的内容中.
我有一个组合框,里面有一个日期列表.我想确保用户实际选择日期.所以,我有以下几点:
if (cmbDateSelecter.SelectedItem.ToString().ToLower().Contains("select") ||
cmbDateSelecter.SelectedItem.ToString().ToLower().Contains("seleccione") ||
cmbDateSelecter.SelectedItem == null)
Run Code Online (Sandbox Code Playgroud)
默认项目是"选择日期",所以我正在检查是否是所选项目.这曾经是自己工作的,由于某种原因,我还没想到,开始抛出NullReferenceExceptions.所以,我添加了空检查.但是,我仍然得到例外.但如果我这样做:
if(cmbDateSelecter.SelectedItem == null)
现在,我知道我可以先进行空检查,一切都会变得笨拙.我的问题是为什么在抛出异常之前不评估所有表达式?如果其中一个是真的,在我的表达式(作为空检查)的情况下,为什么它仍然抛出异常?
好的,所以我为键盘创建了一个用户控件.它看起来像这样:

这个代码是:
<DockPanel DockPanel.Dock="Left">
<StackPanel DockPanel.Dock="Left">
<Button Content="1"
Height="60"
Width="60"
Margin="8"
Name="bttnOne" />
<Button Content="4"
Height="60"
Width="60"
Margin="8"
Name="bttnFour" />
<Button Content="7"
Height="60"
Width="60"
Margin="8"
Name="bttnSeven" />
<Button Content="0"
Height="60"
Width="60"
Margin="8"
Name="bttnZero" />
</StackPanel>
<StackPanel DockPanel.Dock="Left">
<Button Content="2"
Height="60"
Width="60"
Margin="8"
Name="bttnTwo" />
<Button Content="5"
Height="60"
Width="60"
Margin="8"
Name="bttnFive" />
<Button Content="8"
Height="60"
Width="60"
Margin="8"
Name="bttnEight" />
<Button Content="."
Height="60"
Width="60"
Margin="8"
Name="bttnDecimal" />
</StackPanel>
<DockPanel DockPanel.Dock="Left">
<StackPanel DockPanel.Dock="Bottom">
<Button Content="Del"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Width="Auto"
Margin="8"
Height="60"
Name="bttnDelete" />
</StackPanel> …Run Code Online (Sandbox Code Playgroud) 我试图返回一个double四舍五入到两位小数的地方.我已经介入并证实,在我的所有价值观的每一步中,都是如此doubles.这是我的方法:
public double FindAzimuthAtPointK(LwdData pointKData, SurveyData stationOne, SurveyData stationTwo)
{
var deltaDepth = stationTwo.MeasuredDepth - stationOne.MeasuredDepth;
var valueG = FindValueG(pointKData, stationOne, stationTwo);
var valueH = FindValueH(pointKData, stationOne, stationTwo);
var valueY = FindValueY(stationOne, stationTwo);
var sinStationOneInclination = Math.Sin(RadianToDegreeConversion * stationOne.Inclination);
var sinStationTwoInclination = Math.Sin(RadianToDegreeConversion * stationTwo.Inclination);
var sinStationOneInclinationSquared = Math.Pow(Math.Sin(RadianToDegreeConversion * stationOne.Inclination), 2);
var sinStationTwoInclinationSquared = Math.Pow(Math.Sin(RadianToDegreeConversion * stationTwo.Inclination), 2);
var partOneBottom = ((180 * deltaDepth) * Math.Tan(RadianToDegreeConversion * (valueG*valueY) / 2)) / (Math.PI * valueY);
var …Run Code Online (Sandbox Code Playgroud) 我有一个基类,Item和派生类,Weapon&Shield.两者都超载<<.
// item(base) operator overload
ostream& operator<<(ostream& os, const Item& a_item)
{
os << " Item Object - " << endl;
os << " Name: " << a_item.m_name << endl;
os << " Cost: " << a_item.m_cost << endl;
os << " Purpose: " << a_item.m_purpose << endl;
return os;
}
Run Code Online (Sandbox Code Playgroud)
和:
// weapon(derived) operator overload
ostream & operator<<(ostream & os, const Weapon & a_weapon)
{
os << "Weapon - " << endl;
os << " Name: " << a_weapon.m_name …Run Code Online (Sandbox Code Playgroud)