|
i couldnt follow most of your question, but maybe this will help..
you should set focus to the control (textbox, etc.) that you want to have the initial focus..
create an OnLoad() handler for your mainform, and after the panel is displayed call:
this.myPanel.Focus();
or in your OnLoad() of the panel call
this.myTextBox.Focus();
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
MSDN help says you can use a UNC path for any methods
that accept a path, and I'm wondering if I can also
substitute an IP address for the UNC....???
Example:
Using System.IO.File.Move()
File.Move("\\\\MyServer\\share\\dir\\myfile.txt",
"\\\\YourServer\\share\\dir\\myfile.txt");
Should I also be able to use IP address like this?:
File.Move("http://192.168.1.1\\share\\dir\\myfile.txt",
"http://192.166.1.3\\share\\dir\\myfile.txt");
thanks for your input...
vince
|
|
|
|
|
On the network you shouldn't have to include the "http://" portion, but you can use the IP address of the server, usually.
-Nick Parker
|
|
|
|
|
thanks for the reply....
so I could do something like:
"\\\\192.168.1.1\\myshare\\dir\file.txt" ???
thanks for your input..
|
|
|
|
|
vlusardi wrote:
"\\\\192.168.1.1\\myshare\\dir\file.txt" ???
Yes, but you would only use two backwards slashes before the I.P. Address.
-Nick Parker
|
|
|
|
|
Nick,
thanks for the clarification... I'll be trying it out soon...
|
|
|
|
|
Ummm... if this is c++ or c# (non-literal string so things need to be escaped) you would need the double slashes, hence four slashes at the beginning...
Sorry, I being nit-picky....
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Well, with C# you could use a verbatim string with an @ in front of it and you would only need two backwards slashes.
-Nick Parker
|
|
|
|
|
How can I insert a row into a datagrid control that is bounded to a datatable? For clarification, by insert, I mean creating an empty row in the middle of the displayed filled-up rows. Having searched all the websites and entire MDSN library, I would greatly appreciate any tips on this. Thanks!
|
|
|
|
|
Set a handler for the ItemCreated or ItemDataBound and insert the row you want.
|
|
|
|
|
Ok I have a simple function used to resize and create thumbnails. I build the file in vs.net, CreateThumb.cs. Now how do I go about calling that function from an asp page?
I suppose I need to register the DLL etc...so I can call the function in my asp page? Need the syntax for that.
Call CreateThumb(param)
Please help!
Thanks,
Jordan
|
|
|
|
|
jrmcdona wrote:
I suppose I need to register the DLL etc...so I can call the function in my asp page? Need the syntax for that.
It doesn't really work like that. To get a .NET assembly .dll to load in a regular ASP page is a little difficult (though it can be done, check my article Creating a RCW for COM enabled non .NET applications[^] ). Otherwise if you are creating an ASP.NET page, you can simply create an instance of your class and start using it.
-Nick Parker
|
|
|
|
|
Also, the assembly either has to be dropped into the ASP.NET Web Application's private path (usually bin) or installed into the GAC (use gacutil -i <assemblyName> or drag it into \windows\assembly).
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Hello Gurus,
Can anyone give me some good sources on this topic?
Thanks so much
Khang Nguyen
|
|
|
|
|
Use DataGridTableStyles . You can easily do this during design-time with the DataGrid.TableStyles property. You can have multiple table styles, each bound to a different DataMember name (usually tables of a DataSet or something). Within each of these table styles, you specify each column and bind them to a DataColumn name (for each row of the table to which the style is bound). Programmatically, the same procedure is used. Lets say you want the last column of the first table style to be 100 pixels:
int count = dataGrid1.TableStyles[0].GridColumnStyles.Count;
dataGrid1.TableStyles[0].GridColumnStyles[count - 1].Width = 100;
This is for a System.Windows.Forms.DataGrid and can use other data sources other than a DataSet since table styles themselves don't have to bind to any data member and you can just specify the grid columns bound to certain columns / properties in whatever data source you use.
Now, if this is a System.Web.UI.WebControls.DataGrid , you have to use template styles.
In either case, try it in the visual designer, look at the code produced in the source file, and read the docs so you understand exactly what you're reading. It's not that hard and you can customize a lot without overriding anything.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Thank you so much, Health. Your tip is very helpful!
|
|
|
|
|
I have an Extension DLL create from MFC which consists of so many exported classes and would like to be able to use them on my c# project. I know since this is not a pure COM Object and therefore i can't use tlbimp.exe to create Runtime callable Wrapper class for it. As I was reading about Platform Invocation Service (PInvoke) and my question is,
can i export classes from my dll through PInvoke? Or just functions that can be imported from PInvoke? Any Suggestions will be much appreciated.
|
|
|
|
|
|
Leppie,
Can you explain to me a bit about MC++ Mixed mode?
thanks
|
|
|
|
|
|
I have problem. When I try to read the records of the 'MSysObjects' table in my access db, I receive this error message:
Run-time error '3112':
Record(s) can't be read; no read permission on 'MSysObjects'
I know that MSysObjects is a system table, but I don't know why I can't read its records.
I write this code:
/**************************************************************************/
m_oleDBConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+szMDBFileName+";";
m_oleDBConnection.Open();
string t_Clause = "SELECT * FROM MSysObjects WHERE Flags = 0 AND Type = 1";
System.Data.OleDb.OleDbCommand t_Select = new System.Data.OleDb.OleDbCommand(t_Clause, m_oleDBConnection);
try
{
System.Data.OleDb.OleDbDataReader t_Reader = t_Select.ExecuteReader();
}
catch (OleDbException e)
{
string errorMessages = "";
for (int i=0; i < e.Errors.Count; i++)
{
errorMessages += "Index #" + i + "\n" +
"Message: " + e.Errors[i].Message + "\n" +
"NativeError: " + e.Errors[i].NativeError + "\n" +
"Source: " + e.Errors[i].Source + "\n" +
"SQLState: " + e.Errors[i].SQLState + "\n";
}
/**************************************************************************/
Can you tell me please what's the problem ?
Thank you very much for all answer.
|
|
|
|
|
Hello my Gurus,
I could not figure out why my DataSet, more specificly my [M-T] table is not updated at all and no exceptions generated.
iNumOfAffectedRecs is always = 0;
Did I miss something?
Thanks in advance
Khang Nguyen
=================================================================================
private void btnTestUpdate_Click(object sender, System.EventArgs e)
{
MDSConnection MDSConn = new MDSConnection();
OleDbConnection conn = MDSConn.GetCon(); // conn is already open!
string sQuery = "SELECT * FROM [M-T]";
OleDbDataAdapter adapter = new OleDbDataAdapter(sQuery, conn);
DataSet dataSet = new DataSet("Update_DataSet");
adapter.Fill(dataSet);
Console.WriteLine("[M-T] rows = " + dataSet.Tables[0].Rows.Count);
DataRow row = dataSet.Tables[0].NewRow();
row["ModuleID"] = "LK-STT1"; // text
row["TaskID"] = 791; // number
dataSet.Tables[0].Rows.Add(row);
dataSet.Tables[0].AcceptChanges();
Console.WriteLine("[M-T] rows = " + dataSet.Tables[0].Rows.Count);
OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(adapter);
// adapter.Update(dataSet, dataSet.Tables[0].ToString());
int iNumOfAffectedRecs = adapter.Update(dataSet);
MDSConn.Cleanup(); // con is closed
}
|
|
|
|
|
Yes, this line shouldn't be there:
dataSet.Tables[0].AcceptChanges();
DataAdapter objets look for changes to the DataSet and only update what's been changed (inserted, updated, and deleted). When DataAdapter.Update completes, it will automatically call DataSet.AcceptChanges .
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Thanks again, Guru! Let's me try it out.
Khang
|
|
|
|
|
C# seems to use a lot of memory (compared to some of my C++ programs that do similar things.) I was just wondering what you all have observed and I would love to hear the comments of any Java programmers out there. Does Java’s garbage collection work better/faster….. ? (I hope this last question does not start a religious flame war.)
Is there some way to “view” a running C# app in Visual Studio and see what objects have a reference (and therefore are not up for garbage collection)?
|
|
|
|