如果您想了解Winform打开窗口时出现“确保已安装文件类型.cs的应用程序”的解决方法的知识,那么本篇文章将是您的不二之选。同时我们将深入剖析android-即使已安装我的应用程序,它也不会出现在我
如果您想了解Winform打开窗口时出现“确保已安装文件类型.cs的应用程序”的解决方法的知识,那么本篇文章将是您的不二之选。同时我们将深入剖析android-即使已安装我的应用程序,它也不会出现在我的应用程序抽屉中、C# WINFORM 应用程序动态读写xml config文件,获取数、C# winform打开Excel文档的方法总结(必看篇)、C# WinForm打开PDF文件并在窗体中显示的各个方面,并给出实际的案例分析,希望能帮助到您!
本文目录一览:- Winform打开窗口时出现“确保已安装文件类型.cs的应用程序”的解决方法
- android-即使已安装我的应用程序,它也不会出现在我的应用程序抽屉中
- C# WINFORM 应用程序动态读写xml config文件,获取数
- C# winform打开Excel文档的方法总结(必看篇)
- C# WinForm打开PDF文件并在窗体中显示
Winform打开窗口时出现“确保已安装文件类型.cs的应用程序”的解决方法
VS2005在打开窗体设计器(Form1.cs)时弹出错误消息框“确保已安装文件类型(.cs)应用程序”
最简单的解决方法就是只要在“Visual Studio 2005 命令提示”中输入:devenv.exe /resetskippkgs,就可解决问题。
命令提示符在:(Microsoft Visual Studio 2005-->Visual Studio Tools-->Visual Studio 2005 命令提示)
这样一切问题都解决了
android-即使已安装我的应用程序,它也不会出现在我的应用程序抽屉中
为什么应用程序不会出现在应用程序抽屉中?它说在应用程序管理器中已安装它,但由于它不在应用程序抽屉中,所以我似乎无法打开实际的应用程序.一旦安装,它也不会自动打开.
这是我选择在手机(在Jellybean上)上运行时所说的话.当我将其安装到仿真器时,它说的是同一件事.
[2012-09-19 16:20:24 - TheForeverAloneQuiz] Performing sync
[2012-09-19 16:20:24 - TheForeverAloneQuiz] Automatic Target Mode: Several compatible targets. Please select a target device.
[2012-09-19 16:20:28 - TheForeverAloneQuiz] Uploading TheForeverAloneQuiz.apk onto device '001988a8094d8e'
[2012-09-19 16:20:28 - TheForeverAloneQuiz] Installing TheForeverAloneQuiz.apk...
[2012-09-19 16:20:31 - TheForeverAloneQuiz] Success!
[2012-09-19 16:20:31 - TheForeverAloneQuiz] /TheForeverAloneQuiz/bin/TheForeverAloneQuiz.apk installed on device
[2012-09-19 16:20:31 - TheForeverAloneQuiz] Done!
这是android清单.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mikenning.foreveralonequiz"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<activity
android:name=".Introduction"
android:label="@string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.INTRO" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".QuestionOne"
android:label="@string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.QUESTIONONE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Result"
android:label="@string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.RESULTS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
我做错了什么吗?
旁白我也收到错误消息,说我不需要分类为“默认”活动的许可.这可能与它有关吗?在我的一个专栏中,我需要它用于startActivity(),所以真的不需要吗?
解决方法:
我假设介绍是您的第一个活动.您需要向其添加另一个操作,如以下代码所示:
<activity
android:name=".Introduction"
android:label="@string/title_activity_introduction" >
<intent-filter>
<action android:name="android.intent.action.INTRO" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
C# WINFORM 应用程序动态读写xml config文件,获取数
在实际项目里,我们需要用一个应用程序去连接多个数据库,有的进行测试,有的是数据库基本结构相同,数据不同, 我们不可能总去程序的连接字符串里去修改,更不能让用户去修改,所以需要动态去修改连接数据库配置信息。如果安全性可考虑的话需要对字符串加密,我这里写点简单的实现,希望大家有好的方法或意见,请执教和批评。
1 在应用程序里添加app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="ServerIP" value="127.0.0.1"/>
<add key="Server" value="Automation_temp"></add>
<add key="user" value="sa"></add>
<add key="password" value="shan"></add>
</appSettings>
</configuration>
程序读取数据库连接,如下:
如果想把连接的信息显示出来,可以去解析字符串strcon,获取相关信息
private void Open()
...{
// open connection
if (con == null)
...{
string strcon=String.Format ("packet size=4096;data source={0};persist security info=True;initial catalog={1};user id={2};password={3}",ConfigurationSettings.AppSettings["SQLserverIP"],
ConfigurationSettings.AppSettings["Server"],ConfigurationSettings.AppSettings["user"],ConfigurationSettings.AppSettings["password"]);
con = new SqlConnection(strcon);
try
...{
con.Open();
}
catch(Exception ee)
...{
ee.ToString();
}
}
}
2 新建窗体ConfigFrm
添加4个label ,分别是:
服务器ip,Database Name,SA,password,
4个TextBox,分别是:
txtIP
txtDataBaseName
txtName
txtPwd
1个确认按钮btnOK,
3 写个方法保存修改的设置:
private void SaveConfig(string ConnenctionString,string strKey)
...{
XmlDocument doc=new XmlDocument();
//获得配置文件的全路径
string strFileName=AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
doc.Load(strFileName);
//找出名称为“add”的所有元素
XmlNodeList nodes=doc.getElementsByTagName_r("add");
for(int i=0;i<nodes.Count;i++)
...{
//获得将当前元素的key属性
XmlAttribute att=nodes[i].Attributes["key"];
//根据元素的第一个属性来判断当前的元素是不是目标元素
if (att.Value==strKey)
...{
//对目标元素中的第二个属性赋值
att=nodes[i].Attributes["value"];
att.Value=ConnenctionString;
break;
}
}
//保存上面的修改
doc.Save(strFileName);
}
4 在确认按钮btnOK click事件:
private void btnOK_Click(object sender, System.EventArgs e)
...{
if (txtIP.Text=="")
...{
MessageBox.Show("ServerIP is not allow null");
return ;
}
else if(txtDataBaseName.Text=="")
...{
MessageBox.Show("DataBase is not allow null");
return ;
}
else if(txtName.Text=="")
...{
MessageBox.Show("User Name is not allow null");
return ;
}
else
...{
SaveConfig(txtIP.Text,"ServerIP");
SaveConfig(txtDataBaseName.Text,"Server");
SaveConfig(txtName.Text,"user");
SaveConfig(txtPassword.Text,"password");
MessageBox.Show("Config Sucessful!","",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
this.Close();
}
在应用程序当前目录下,程序动态加载的是 /bin/debug/test.exe.config信息,从而实现了动态读写xml文件,去获取
数据库连接。
在实际项目里,我们需要用一个应用程序去连接多个数据库,有的进行测试,有的是数据库基本结构相同,数据不同, 我们不可能总去程序的连接字符串里去修改,更不能让用户去修改,所以需要动态去修改连接数据库配置信息。如果安全性可考虑的话需要对字符串加密,我这里写点简单的实现,希望大家有好的方法或意见,请执教和批评。
1 在应用程序里添加app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="ServerIP" value="127.0.0.1"/>
<add key="Server" value="Automation_temp"></add>
<add key="user" value="sa"></add>
<add key="password" value="shan"></add>
</appSettings>
</configuration>
程序读取数据库连接,如下:
如果想把连接的信息显示出来,可以去解析字符串strcon,获取相关信息
private void Open()
...{
// open connection
if (con == null)
...{
string strcon=String.Format ("packet size=4096;data source={0};persist security info=True;initial catalog={1};user id={2};password={3}",ConfigurationSettings.AppSettings["SQLserverIP"],
ConfigurationSettings.AppSettings["Server"],ConfigurationSettings.AppSettings["user"],ConfigurationSettings.AppSettings["password"]);
con = new SqlConnection(strcon);
try
...{
con.Open();
}
catch(Exception ee)
...{
ee.ToString();
}
}
}
2 新建窗体ConfigFrm
添加4个label ,分别是:
服务器ip,Database Name,SA,password,
4个TextBox,分别是:
txtIP
txtDataBaseName
txtName
txtPwd
1个确认按钮btnOK,
3 写个方法保存修改的设置:
private void SaveConfig(string ConnenctionString,string strKey)
...{
XmlDocument doc=new XmlDocument();
//获得配置文件的全路径
string strFileName=AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
doc.Load(strFileName);
//找出名称为“add”的所有元素
XmlNodeList nodes=doc.getElementsByTagName_r("add");
for(int i=0;i<nodes.Count;i++)
...{
//获得将当前元素的key属性
XmlAttribute att=nodes[i].Attributes["key"];
//根据元素的第一个属性来判断当前的元素是不是目标元素
if (att.Value==strKey)
...{
//对目标元素中的第二个属性赋值
att=nodes[i].Attributes["value"];
att.Value=ConnenctionString;
break;
}
}
//保存上面的修改
doc.Save(strFileName);
}
4 在确认按钮btnOK click事件:
private void btnOK_Click(object sender, System.EventArgs e)
...{
if (txtIP.Text=="")
...{
MessageBox.Show("ServerIP is not allow null");
return ;
}
else if(txtDataBaseName.Text=="")
...{
MessageBox.Show("DataBase is not allow null");
return ;
}
else if(txtName.Text=="")
...{
MessageBox.Show("User Name is not allow null");
return ;
}
else
...{
SaveConfig(txtIP.Text,"ServerIP");
SaveConfig(txtDataBaseName.Text,"Server");
SaveConfig(txtName.Text,"user");
SaveConfig(txtPassword.Text,"password");
MessageBox.Show("Config Sucessful!","",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
this.Close();
}
在应用程序当前目录下,程序动态加载的是 /bin/debug/test.exe.config信息,从而实现了动态读写xml文件,去获取
数据库连接。
C# winform打开Excel文档的方法总结(必看篇)
C#打开Excel文档方法一:调用Excel的COM组件
在项目中打开Add Reference对话框,选择COM栏,之后在COM列表中找到"Microsoft Excel 11.0 Object Library"(Office 2003),然后将其加入到项目的References中即可。Visual C#.NET会自动产生相应的.NET组件文件,以后即可正常使用。
按钮的点击事件如下:
privatevoid button1_Click(object sender,EventArgs e) { Excel.Application excel = new Excel.Application(); //引用Excel对象 Excel.Workbook book = excel.Application.Workbooks.Add("c:\\test.xls"); //引用Excel工作簿 excel.Visible = true; //使Excel可视 }
C#打开Excel文档方法二:利用命令行
我们在开始→运行里输入c:\\test.xls,后如果电脑安装有Excel的话他也会自动的打开这个文件,代码如下:
privatevoid button1_Click(object sender,EventArgs e) { System.Diagnostics.Process.Start("c:\\test.xls"); }
C#打开Excel文档的具体方法的介绍就向你介绍到这里,希望对你了解和学习C#打开Excel文档有所帮助。
我的一点看法:
private void button1_Click(object sender,EventArgs e) { Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application(); Workbook wkb = app.Workbooks.Add(@"E:\Work\DemoBase_091111\CSharpOpenExcel\cshapropenexcel.xlsx"); //打开已经存在的excel,//而通过gdal打开已经存在的shp,方法为 // OSGeo.GDAL.Gdal.AllRegister(); // OSGeo.GDAL.Dataset dataSet = OSGeo.GDAL.Gdal.Open(@"E:\Work\DemoBase_091111\GDALTEST\testshapefile\point_out.shp",Access.GA_ReadOnly); //二者是差不多的,一个用add方法,一个用open方法,都得到了可以进行下一步操作的文件,技术具有相同性 app.Visible = true; }
以上这篇C# winform打开Excel文档的方法总结(必看篇)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程小技巧。
C# WinForm打开PDF文件并在窗体中显示
1.添加引用
工具箱---右键---选择项--COM组件--Adobe PDF Reader
2.使用方法
OpenFileDialog openFile=new OpenFileDialog();
open..Filter = "PDF文件|*.pdf";
openFile.ShowDialog();
axAcroPDF1.src = openFile.FileName;
//axAcroPDF1.LoadFile(of.FileName); //使用方法二
除了这种方法,网上还有一些开源的项目,可以直接打开PDF文件,大家也可以参考下
http://www.codeproject.com/KB/silverlight/BlendPDFwithSilverlight.aspx
http://www.codeproject.com/KB/applications/PDFViewerControl.aspx
关于Winform打开窗口时出现“确保已安装文件类型.cs的应用程序”的解决方法的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android-即使已安装我的应用程序,它也不会出现在我的应用程序抽屉中、C# WINFORM 应用程序动态读写xml config文件,获取数、C# winform打开Excel文档的方法总结(必看篇)、C# WinForm打开PDF文件并在窗体中显示等相关知识的信息别忘了在本站进行查找喔。
本文标签: