|
.Net framework doesn't provide a way to get an AppDomain based on its friendly name. One can get the current thread's AppDomain, but I would like to get an AppDomain based on just its friendly name. Has somebody tried it?
Any help is welcome.
|
|
|
|
|
i have a button and label in my webform and i want in OnClientClick event,change a label1.Text (in client Side by javaScript),I wrote this code :
<script language="javascript"><br />
function SetClientLabel()<br />
{<br />
document.getElementById("label1").value = "Value Chaned!";<br />
}<br />
</script>
but at runTime, when i Click on button, Nothing event Occured,Where is the Problem and how to solve it ?
Note : i want only change label.Text and don't need ajax or atlas or ...etc. i need java Code(if necessary) and Know how to do this.
Thanks.
|
|
|
|
|
Please try something like:
function SetClientLabel(str)
{
document.getElementById("label1").innerText = str;
}
|
|
|
|
|
Very Very thanks ..My Problem Has beed Solved.
but does any way for execute javaScript method for OnClick property of my button?
thanks.
|
|
|
|
|
Currently, I can easily drag items between DGV's. If I select multiple items by holding the CTRL button while I click, and on the last item, I initiate the drag without letting up the mouse, I am able to drag multiple items.
However, if I select the last item, let up the mouse button, and then put it back down again to grab the items and drag them, the DGV selects the item that was under the mouse click. I realize this is the expected behavior; does anyone know a way to override it so that my items remain selected?
Now, I have a workaround that involves keeping track of the selected items myself, and if the mouse goes up and backdown and a drag begins, to re-select those items. But it's a little bit messy and I would really like another way to do it.
Any thoughts?
|
|
|
|
|
This is a 2005 project under 2.0
I am using Enterprise Library 2006
I am making a Select Call which returns an IDataReader.
I have checked the object after being populated and it seems to contain the information I need.
I go to convert it to a DataSet and it only shows the last item.
here is my Convert to DataSet code, I've tried numerous of examples found on the web, each one only returns the last record:
<br />
public static DataSet ConvertDataReadertoDataSet(IDataReader reader)<br />
{<br />
DataSet ds = new DataSet();<br />
DataTable schema;<br />
DataTable data;<br />
int i = 0;<br />
DataRow dr;<br />
DataColumn dc;<br />
string columnName;<br />
bool dun = false;<br />
data = new DataTable();<br />
schema = reader.GetSchemaTable();<br />
<br />
do<br />
{<br />
if (schema != null)<br />
{<br />
for (i = 0; i <= schema.Rows.Count - 1; i++)<br />
{<br />
dr = schema.Rows[i];<br />
columnName = dr["ColumnName"].ToString();<br />
if (data.Columns.Contains(columnName))<br />
{<br />
columnName = columnName + "_" + i.ToString();<br />
}<br />
if (columnName == "ID")<br />
{<br />
System.Type typeInt32 = System.Type.GetType("System.Int32");<br />
<br />
dc = new DataColumn(columnName, typeInt32);<br />
}<br />
else<br />
{<br />
System.Type typeString = System.Type.GetType("System.String");<br />
<br />
dc = new DataColumn(columnName, typeString);<br />
}<br />
<br />
<br />
data.Columns.Add(dc);<br />
}<br />
<br />
<br />
ds.Tables.Add(data);<br />
<br />
while (reader.Read())<br />
{<br />
dr = data.NewRow();<br />
for (i = 0; i <= reader.FieldCount - 1; i++)<br />
{<br />
dr[i] = reader.GetValue(i);<br />
}<br />
data.Rows.Add(dr);<br />
}<br />
}<br />
else<br />
{<br />
dc = new DataColumn("RowsAffected");<br />
data.Columns.Add(dc);<br />
ds.Tables.Add(data);<br />
dr = data.NewRow();<br />
dr[0] = reader.RecordsAffected;<br />
data.Rows.Add(dr);<br />
}<br />
<br />
}while (reader.NextResult());<br />
<br />
reader.Close();<br />
<br />
return ds;<br />
}
I f10'd through it and it seems to only be doing the 'do/while' once, the NextResult() is not going to the last record because it seems like its already at the last record.
Any suggestions or examples of another way of doing it would be great.
it needs to return a DataSet with multiple records.
Thanks
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
NextResult moves the data reader on to the next result set, not the next row. Read moves the reader to the next row until it gets to the last row in the current result set.
|
|
|
|
|
Thank you for the reply. I found a way to work with the IDataReader that I am getting back so there is no need to convert it.
Appreciate the time on this though, enjoy your day.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
I would like to create different versions of a program, but I'm not sure how to achieve that in VS2005. I've looked at configurations and conditional compilation, but I haven't found anything that works yet.
Here's what I would like to do:
I need three versions of a program:
Version 1
=========
* Contains a user interface for analysing data
* Contains code and a user control for talking
to an electric motor, also contains a dll
that does the low level communication with
the electric motor.
This version would be installed on computers that have the electric motor attached.
Version 2
=========
* Contains only the user interface for analysing
data
This version would be installed on computers that don't have the electric motor installed. They would therefore also not have the dll and not need the user control for talking to the motor.
Version 3
=========
* Contains a simplified user interface for displaying results of the analysis.
What's the best way to achieve having these separate versions?
Thanks for your help.
|
|
|
|
|
Why not have several project in the same solution. Each sharing the source code for the items each version needs.
|
|
|
|
|
Thanks for your answer.
The reason, why I would like to avoid it is this: When I add a new source file to one of the projects, I have to add it to all projects, in case it is needed there. That is fine with a small project, but this one will over time get rather large and I want to keep maintenance of different versions to a minimum.
|
|
|
|
|
Conditional compilation is for small changes between different versions of the same assembly - e.g. DEBUG vs. RELEASE or excluding some features in a compact framework build.
You should create separate libraries for each module of your program and create three .exe files that use the libraries required for that version.
|
|
|
|
|
i want code for authentication's to connect remote computer and accessing the files in remote computer. Code in C# with windows app if possible
this is haneef
|
|
|
|
|
What have you done so far?
|
|
|
|
|
the following code for backup a database stadard form of zip file.
it is working properly for c# with windows app but not C# with asp. why i don't know.
in c# with windows also one problem it is not connecting to remote server database.
using System.Data.SqlClient;
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using SQLDMO;
using System.IO;
using System.Diagnostics;
using Shell32;
using System.Xml;
using System.Security.Permissions;
using System.Configuration;
namespace backup1
{
///
/// Summary description for WebForm1.
///
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.TextBox t1;
protected System.Web.UI.WebControls.TextBox t2;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.ListBox lb;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
/*SQLDMO.Application oSQLServerDMOApp = new SQLDMO.Application();
SQLDMO.NameList oNameList;
oNameList = oSQLServerDMOApp.ListAvailableSQLServers();
for (int intIndex = 0; intIndex <= oNameList.Count - 1; intIndex++)
{
if (oNameList.Item(intIndex as object) != null)
{
lb.Items.Add(oNameList.Item(intIndex).ToString());
}
}
if (lb.Items.Count > 0)
lb.SelectedIndex = 0;
else
lb.Items.Add("(local)");*/
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button2_Click(object sender, System.EventArgs e)
{
string s="";
string con="";
string del2="";
string s1="";
string del1="";
int len1=0;
string k="";
string temp="";
string database1="";
string temp1="";
try
{
Login2Class s12=new Login2Class();
SQLServer2Class server = new SQLServer2Class();
Databases databases;
Database2 database;
Backup2Class backup = new Backup2Class();
//SqlConnection con11=new SqlConnection("user id=sa ; password=sa123; data source=192.168.1.6; database=pubs");
//con11.Open();
server.LoginSecure = true;
server.Connect("192.168.1.6" ,"administrator" ,"");
databases = server.Databases;
database1=t1.Text;
database = (Database2) databases.Item(database1, null);
backup.PercentCompleteNotification = 1;
backup.Database = database.Name;
int len=0;
s=TextBox2.Text;
if(s.ToUpper().EndsWith(".BAK") == true)
{
len1=s.Length;
s=s.Substring(0,len);
}
System.IO.Directory.CreateDirectory(s);
temp= System.IO.Directory.CreateDirectory(s).ToString();
s=s+"\\"+temp;
try
{
if(s.ToUpper().EndsWith(".BAK") == false)
{
s += ".bak";
}
del2=s;
backup.Files = s;
temp1=s;
backup.SQLBackup(server);
server.DisConnect();
backup = null;
server = null;
}//try
catch(Exception ex)
{
Response.Write(ex.ToString());
}
s1=s;
con="\\"+temp+".bak";
if(s1.EndsWith(con)==true)
{
len1=s1.IndexOf(con);
k=s1.Substring(0,len1);
}
con=temp+".bak";
if(s1.EndsWith(con)==true)
{
len1=s1.IndexOf(con);
s1=s1.Substring(0,len1-1);
}
del1=s1;
if(s.ToUpper().EndsWith(".ZIP") == false)
{
s1 += ".zip";
}
byte[] emptyzip = new byte[] {80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
FileStream fs= File.Create(s1);
fs.Write(emptyzip, 0, emptyzip.Length);
fs.Flush();
fs.Close();
fs = null;
//Copy a folder and its contents into the newly created zip file
Shell32.ShellClass sc = new Shell32.ShellClass();
Shell32.Folder SrcFlder = sc.NameSpace(k);
Shell32.Folder DestFlder = sc.NameSpace(s1);
Shell32.FolderItems items = SrcFlder.Items();
DestFlder.CopyHere(items, 0);
int i=DestFlder.Items().Count;
while(items.Count >= i)
{
System.Threading.Thread.Sleep(1000);
}
System.Threading.Thread.Sleep(1000);
System.Threading.Thread.Sleep(1000);
System.Threading.Thread.Sleep(1000);
System.IO.File.Delete(del2);
System.IO.Directory.Delete(del1);
Response.Write("zip file created in location ::" + s1);
}//try
catch(System.Runtime.InteropServices.COMException ex)
{
Response.Write(ex.ToString());
}
catch(System.Exception ex)
{
Response.Write(ex.ToString());
}
}
}
}
this is haneef
|
|
|
|
|
I am having a tabcontrol.Tab pages are added to it dynamically.Tab pages are type of "Form". On that form i am dragging a control.On the drag over event i get the e.X & e.Y position (screen coordinates).When i convert to Client coordinates i dont get the exact dropped location for control.
Like 1 big rectangle(tab page) with embedded small rectangle(Form).When control is dragged in small rectangle(Form) i dont get exact location.When i drag control to 0,0 position of small rectangle(Form) i get some other value(42,136).
Can anyone help me.Thanks in advance.
|
|
|
|
|
hi i am just wondering if there is a way to query a datatable so as to find out if there is a row whos date exists between 2 specified dates and if so where wud i be able to read an intro to thi thanks in advance
tim
|
|
|
|
|
|
Yes. You can use the DataView class. Set the rowfilter = "field > " + date.toshortstring " + " and " + "field < " + date.toshortstring
Check you help files for the exact syntax, I'm just going from memory.
|
|
|
|
|
ok thanks alot folks
worked perfectly and in about one fifth of the time thanks alot
|
|
|
|
|
How Can I Make Setup File In C#.NET 2003 including The database files
just to run automaticly on other pc's .
|
|
|
|
|
kifahhk wrote: How Can I Make Setup File In C#.NET 2003
Gee I don't know... hey maybe with a Setup and Deployment Project?
led mike
|
|
|
|
|
Stop, it can't be that easy
I'm sure he looked everywhere before posting
|
|
|
|
|
the subject is self-explanatory
|
|
|
|
|
I'm sure you scoured this site and found nothing
But, here's one:
http://www.codeproject.com/dotnet/Auto_Increment_Version.asp
|
|
|
|