昨天,我已经在我的embarcadero delphi 2010中安装了专为Delphi 7设计的TPing组件,但今天我发现当我点击"开始"按钮时,这个组件会导致我的应用程序因访问冲突错误而崩溃.
我在互联网上搜索导致访问语音问题的最常见原因,我发现了一些原因,其中包括安装与当前版本不兼容的软件包/组件.因此,我猜这个组件是我的访问冲突错误的原因.
请问您如何卸载组件/包.并恢复在安装过程中自动生成的备份.
在我的应用程序中,我创建了一个注册表单,每当Edit为空或包含一些错误时我都需要显示一个错误图标.但是图像没有Name属性,因此我无法通过名称来调用隐藏图像.因此我决定将图像放入面板并隐藏面板.就像是 :
if(lenght(edit1.text)=0) then
Panel1.show else Panel1.hide; // this code shows or hide the image
Run Code Online (Sandbox Code Playgroud)
问题是在将BorderStyle设置为bsNone后,面板的边框仍然出现.
如何完全隐藏面板的边框?
我想在提交具有某些操作的表单时显示一个警报框.. 我在 jquery 上这样做:
<script type="text/javascript">
$("form[action='#jsquick']").submit(function() {
alert("Signup");
return false;
});
</script>
Run Code Online (Sandbox Code Playgroud)
上面纯 javascript 中的代码的等价物是什么?
我的代码如下,它工作正常但是,但是在编译程序后,我看到所有全名和国家/地区垂直列出的内容如下:
_________________________________全
名1
国家1全
名2
国家2全
名
3 国家3
等...
SQLQuery1.SQL.Text := 'SELECT * FROM users where user_age="'+age+'"';
SQLQuery1.Open;
rec := SQLQuery1.RecordCount;
SQLQuery1.First; // move to the first record
ListView1.Visible := false;
if rec>0 then
begin
while(not SQLQuery1.EOF)do begin
ListView1.Visible := true;
// do something with the current item
ListView1.AddItem('Full name: '+SQLQuery1['fullname'], Self);
ListView1.AddItem('Country: '+SQLQuery1['cntry'], Self);
// move to the next record
SQLQuery1.Next;
end;
Run Code Online (Sandbox Code Playgroud)
但我想要的东西像:

我有一个基于tcp的客户端 - 服务器应用程序.我能够发送和接收字符串,但不知道如何发送字节数组.
我正在使用以下函数从客户端向服务器发送字符串:
static void Send(string msg)
{
try
{
StreamWriter writer = new StreamWriter(client.GetStream());
writer.WriteLine(msg);
writer.Flush();
}
catch
{
}
}
Run Code Online (Sandbox Code Playgroud)
通讯实例
客户端发送字符串:
Send("CONNECTED| 84.56.32.14")
Run Code Online (Sandbox Code Playgroud)
Server收到一个字符串:
void clientConnection_ReceivedEvent(Connection client, String Message)
{
string[] cut = Message.Split('|');
switch (cut[0])
{
case "CONNECTED":
Invoke(new _AddClient(AddClient), client, null);
break;
case "STATUS":
Invoke(new _Status(Status), client, cut[1]);
break;
}
}
Run Code Online (Sandbox Code Playgroud)
我需要一些帮助来修改上面的函数,以便除了字符串之外还发送和接收字节数组.我想打这样的电话:
Send("CONNECTED | 15.21.21.32", myByteArray);
Run Code Online (Sandbox Code Playgroud) 为什么下面的代码不起作用?
string Tmp_actionFilepath = @"Temp\myaction.php";
// change the id and the secret code in the php file
File.Copy(@"Temp\settings.php", Tmp_actionFilepath, true);
string ActionFileContent = File.ReadAllText(Tmp_actionFilepath);
string unique_user_id = textBox5.Text.Trim();
string secret_code = textBox1.Text.Trim();
ActionFileContent.Replace("UNIQUE_USER_ID", unique_user_id);
ActionFileContent.Replace("SECRET_CODE", secret_code);
File.WriteAllText(Tmp_actionFilepath, ActionFileContent);
Run Code Online (Sandbox Code Playgroud)
这是setting.php的内容
<?php
session_start();
$_SESSION["postedData"] = $_POST;
/////////////////////////////////////////////////////////
$_SESSION["uid"] = "UNIQUE_USER_ID";
$_SESSION["secret"] = "SECRET_CODE";
/////////////////////////////////////////////////////////
function findThis($get){
$d = '';
for($i = 0; $i < 30; $i++){
if(file_exists($d.$get)){
return $d;
}else{
$d.="../";
}
}
}
$rootDir = findThis("root.cmf");
require_once($rootDir."validate_insert.php");
Run Code Online (Sandbox Code Playgroud)
上面的代码有什么问题?在c#中编译代码之后,我注意到创建了myaction.php文件,但是值:UNIQUE_USER_ID和SECRET_CODE没有改变,我还尝试复制/粘贴这些值以确保它们是相同的.但代码始终不起作用
我正在用c#开发一个应用程序,我的目标是net framework 4.0.在我的解决方案的proprieties窗口中,我将目标框架更改为NET Framework 2.0,但应用程序突然停止工作.它向我显示以下错误:
No overload for method ToString() takes 1 argument
导致错误的代码:
DateTime endTime;
string endDate = get_end_date_fromDB();
if (DateTime.TryParseExact(endDate, "dddd, MMMM dd, yyyy", null, DateTimeStyles.None, out endTime))
{
TimeSpan ts = endTime.Subtract(DateTime.Now);
label1.Text = ts.ToString("d' Jours 'h' Heures 'm' Minutes'"); // <<<< THIS LINE IS CAUSING THE ERROR
}
Run Code Online (Sandbox Code Playgroud)
是否有一种解决方法可以使上面的代码在C#2.0上运行?我需要以特定格式显示日期.
我正在创建一个基于显示一些用户应该接受或拒绝的通知的应用程序
如何在不在任务栏上方的屏幕右下方显示请求表单?

代码:
notificationForm ntf = new notificationForm();
ntf.ShowDialog();
Run Code Online (Sandbox Code Playgroud)
任何帮助将受到高度赞赏
我正在创建一个聊天应用程序,我想在Bold中显示名称.首次加载表单时,我RichTextBox使用这些代码行在控件上显示数据库中的历史记录对话,我想以粗体显示名称:
以下是使这成为可能的所有代码:
string strProvider = "Data Source=" + srv_host + ";Database=" + srv_db + ";User ID=" + srv_user + ";Password=" + srv_pass;
MySqlConnection myConn = new MySqlConnection(strProvider);
try
{
myConn.Open();
string strCmd = "SELECT * FROM comments WHERE task_id=@task_id AND ((from_usr=@from AND to_usr=@to) OR (from_usr=@to AND to_usr=@from)) ORDER BY at_time ASC";
MySqlCommand myCmd = new MySqlCommand(strCmd, myConn);
myCmd.Parameters.AddWithValue("from", frm_usr);
myCmd.Parameters.AddWithValue("to", to_usr);
myCmd.Parameters.AddWithValue("task_id", tid);
myCmd.ExecuteNonQuery(); // execute now
MySqlDataReader dr = myCmd.ExecuteReader();
while (dr.Read())
{
string text …Run Code Online (Sandbox Code Playgroud) ....
case "DOWNLOAD":
if (File.Exists(commandContent)) {
MessageBox.Show(commandContent);
result = System.Convert.ToBase64String(File.ReadAllBytes(commandContent)); //ERROR
result = HttpUtility.UrlEncode(result);
}
break;
Run Code Online (Sandbox Code Playgroud)
并且未处理的错误异常在路径中显示"非法字符".MessageBox显示正确的路径
C:\Users\Me\Myfile.exe
Run Code Online (Sandbox Code Playgroud)
我试着做以下事情:
commandContent = commandContent.replace(@"\",@"\\");
result = System.Convert.ToBase64String(File.ReadAllBytes(commandContent)); //ERROR
Run Code Online (Sandbox Code Playgroud)
我也尝试过以下方法:
commandContent = @""+commandContent+"";
result = System.Convert.ToBase64String(File.ReadAllBytes(commandContent)); //ERROR
Run Code Online (Sandbox Code Playgroud)
但这不起作用.而且更奇怪的是它正常工作,但是一旦我将commandContent插入db(使用ajax而不是常规表单提交)的方式进行了一些修改,这个问题出现了?
编辑:
我尝试使用硬编码路径
commandContent = @"C:\Users\Me\file.exe";
Run Code Online (Sandbox Code Playgroud)
这工作正常.如何强制变量不包含任何非法字符?
c# ×6
.net ×3
delphi ×3
delphi-2010 ×3
.net-2.0 ×2
border ×1
datetime ×1
file ×1
image ×1
javascript ×1
jquery ×1
mysql ×1
richtextbox ×1
taskbar ×1
tcpclient ×1
tcplistener ×1
tlistview ×1
tpanel ×1