我想在特定的索引处将新的DataGridViewRow插入到我的DataGridView中.如果我只是创建一个新的行
DataGridViewRow dgwr = new DataGridViewRow();
datagridview1.Rows.Insert(index, dgwr);
Run Code Online (Sandbox Code Playgroud)
我不会得到DataGridView的"设置",例如我的"Cells"将为0.如果我使用,这不会发生.
DataGridView1.Add();
Run Code Online (Sandbox Code Playgroud)
但话说回来,然后我不能选择列表中的哪个位置我希望发布...
无论如何要结合这些优势吗?
/缺口
当我尝试录制然后播放刚刚录制的文件时,我遇到了问题.我可以录制和播放声音,但质量很糟糕.它不仅仅是坏的,很难听,听起来有点像计算机生成的声音.我使用andriod SDK-emulator.设置录音的代码如下所示;
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
Run Code Online (Sandbox Code Playgroud)
以后播放文件的代码看起来像这样;
MediaPlayer mp = new MediaPlayer();
mp.reset();
mp.setDataSource(path);
mp.prepare();
mp.start();
Run Code Online (Sandbox Code Playgroud)
我不知道是什么部分使音频文件听起来非常糟糕,或者它只是模拟器使它变坏并且它可以在真正的手机上工作.
我的 Windows Froms C# 应用程序刚刚遇到了最奇怪的问题
我的代码中有一些Console.WriteLine用于调试,但突然它停止工作了。例如
try{
line(of.code);
Console.WriteLine("HERE");
other.line(of.code);
}
catch (Exception e)
{
logger.logg(e.ToString());
}
Run Code Online (Sandbox Code Playgroud)
我不会到达线路other.line(of.code);,并且我在控制台中没有收到“HERE”。
代码中有几个地方,所有地方都会发生同样的情况。它只是停止了,它没有到达目标......
最糟糕的是,它更早地起作用了。我从事应用程序工作很长时间了,从未见过这样的事情。
我有一个应用程序与USB-GPS交谈.它是一种魅力,如果没有任何不寻常的幸福.但我有一个大问题.如果USB被拔出,我的程序(有时)会崩溃.我有Try/Catch我需要它们但是这个IOExeption没有被捕获.我只是得到"设备无法识别命令",程序停止.以下是启动端口的代码:
public LatLongFromGPS(Form1 parent)
{
this.parent = parent;
String port;
this.SPort = new SerialPort(port, 4800);
this.SPort.ReadTimeout = 500;
this.SPort.DataReceived += new SerialDataReceivedEventHandler(dataReceived);
}
public bool checkIfPortsOpen()
{
return (this.SPort.IsOpen);
}
public void openPort()
{
try
{
if (!this.SPort.IsOpen)
{
this.SPort.Open();
}
}
catch(Exception ex)
{
parent.LoggIt.WriteLogg("OPENPORT " + ex.ToString(), Logger.LoggType.Debug);
}
}
public void dataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
if (SPort.IsOpen)
{
String GPGGAString;
Thread.CurrentThread.Join(200);
buffert = new char[this.SPort.BytesToRead];
this.SPort.Read(buffert, 0, buffert.Length);
GPGGAString = findStringFromGPS();
if (GPGGAString != …Run Code Online (Sandbox Code Playgroud) 我正在运行一项服务,该服务连接到一些客户端。它已经启动并运行了几周,这个函数每分钟都会被调用很多次,我在不同的函数中有一些捕获,但是这个异常使它一路崩溃。我以前从未见过这个问题。谁能让这一切发生?
堆:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.DataSourceWrapper ByRef)
at System.Data.OleDb.OleDbConnectionInternal..ctor(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.OleDbConnection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(System.Data.Common.DbConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at EServer.Database.DBManager.DoesObjectExsist(System.String)
at EServer.Database.DBManager.setObjectOnline(System.String, Boolean, System.String, System.String)
at EServer.Network.SocketListener.handleToDo()
at EServer.Network.Token.ProcessData(System.Net.Sockets.SocketAsyncEventArgs)
at EServer.Network.SocketListener.ProcessReceive(System.Net.Sockets.SocketAsyncEventArgs)
at EServer.Network.SocketListener.OnIOCompleted(System.Object, System.Net.Sockets.SocketAsyncEventArgs)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs)
at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(System.Net.Sockets.SocketError, Int32, System.Net.Sockets.SocketFlags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, …Run Code Online (Sandbox Code Playgroud) 我猜这个标题不是最好的,但我有两个嵌套列表的问题,第一个是内联的,并在点击时扩展第二个.第二个是常规列表.
我的问题是,即使扩展了其他列表,我也希望将主列表保持连续,现在第一个列表中的第二个项目向下移动.
这是代码:
.toggle-box {
display: none;
}
.toggle-box + label {
cursor: pointer;
display: block;
font-weight: bold;
line-height: 21px;
margin-bottom: 5px;
}
.toggle-box + label + div {
display: none;
margin-bottom: 10px;
}
.toggle-box:checked + label + div {
display: block;
}
.toggle-box + label:before {
background-color: #4F5150;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
color: #FFFFFF;
content: "+";
display: block;
float: left;
font-weight: bold;
height: 20px;
line-height: 20px;
margin-right: 5px;
text-align: center;
width: 20px;
}
.toggle-box:checked + label:before { …Run Code Online (Sandbox Code Playgroud)我得写一个SQL查询,ProductNr如果其他两个值不同,我得到值.
我此刻得到了这个查询,但它不起作用......
SELECT
Table1.productNr, Table1.info2
FROM
Table1
INNER JOIN
ON Table1.productNr = Table2.productNR
WHERE
Table1.info2 <> Table2.info2
Run Code Online (Sandbox Code Playgroud) c# ×4
android ×1
audiorecord ×1
console ×1
css ×1
datagridview ×1
html ×1
html5 ×1
ioexception ×1
serial-port ×1
service ×1
sql ×1