|
Didn't show up properly:
HKEY_CLASSES_ROOT/<file type>/DefaultIcon
|
|
|
|
|
Hi,
Thanks for your awnser!
I've tried that already but it doesn't seems to be the right way to do that.
There are a lot of entries that don't have the DefaultIcon entry but still have an icon associated with it.
|
|
|
|
|
|
I downloaded some projects but it didnot work because of
(usin system.win.forms) which doesnot exists....can u tell me how to make my application recognizes this directive?
|
|
|
|
|
try using System.Windows.Forms;
To those who didn't make it, we will remember you. To those who did is back. - Megan Forbes in Black FridayAnother Post by NnamdiOnyeyiri
|
|
|
|
|
also make sure the references include the system.windows.forms dll normaly located at
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll
|
|
|
|
|
is there any method to get windows and system directory in c# ?
and how to get the version of windows ?
thanks .... !
|
|
|
|
|
kendao wrote:
is there any method to get windows and system directory in c# ?
Environment.SystemDirectory
kendao wrote:
how to get the version of windows ?
Environment.Version
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Hi,
Using the VS IDE, I have a Form which loads and manages a DataSet. The form contains UserControls that need to references the same DataSet. Using the IDE, while designing the UserControl, how do I reference the DataSet in the parent Form?
As an interim solution I drag/drop another DataSet onto the UserControl and do all my object DataBindings to that DataSet. But, after the initialization of the UserControl I have to modify each objects DataBindings to reference the DataSet in the Parent Form.
Is there a better(correct) way of doing it?
|
|
|
|
|
The best way is to have the child controls reference the DataSet from the parent form (defined as Form1 in this example). Just cast the Parent property to Form1 and get the reference to the DataSet that you should define as a public or internal property:
public class Form1 : Form
{
private DataSet dataSource;
public DataSet DataSource
{
get { return this.dataSource; }
}
}
public class UserControl1 : UserControl
{
private void BindMe()
{
SomeMethodThatBindsData(((Form1)Parent).DataSource);
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath
Thankyou for your response, I do appreciate it.
Your example is basically what the result should be, just I want to do it with the IDE. I have many UserConstrols on various forms and it would require typing the DataBinding for each object, which I have actually done using an enumaration over all controls over all DataBindings.
If I could have replaced the 'DataSet ds = new DataSet()' in the 'InitializeComponent()' function with a reference to the DataSet it would have solved the problem or if I could have overloaded the 'new' keyword for a DataSet, which I don't think I is possible, or is it?
Yours Sincerely
Festus
|
|
|
|
|
You can't override the new operator, but you can create a ContextBoundObject with its own RealProxy derivative that returns a singleton, but this is more work that necessary and since the DataSet would need to be marshalled across boundaries, it would degrade performance.
Relying on the IDE is poor programming. It can't do everything. You can, however, use the DataBindings property and type in the expression if you like, but you'll still need to cast Parent to the form in order to access the variable you'll need since Form doesn't have a property defined for whatever property returns your DataSet .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i want to abtain remote screen capture on the pc in LAN.
i was suggested to transmit the changed parts only to save the bandwidth.
so i divide the screen into 10*10 parts. and now , i need to display the
remote screen on my own form. my method is use this:
Graphics c = this.createGraphics();
c.drawImage(imageparts,xcoodinary,ycoodinary);// imageparts is ONE part
// of the screen (1/100)
whenever i receive a imageparts, i use the code above to draw the changed
screen parts on a FORM. the code seems to work well.In the first time,i
should call this code 100 times to get the original screen.after then , i
could only call this code several times.
but now ,when the FORM is changed or covered by other windows , with the
repaint result ,the image disappeared or changed into a wrong display.
So i should put the code above into OnPaint method. but the code above only
redraws the changed parts of the remote screen, the others disappeared.
How can i redraw the previous unchanged image already on the FORM ? OR are
there other methods to solve this problem ?
THX!
|
|
|
|
|
The is a C# implemetation of VNC on SourceForge.
|
|
|
|
|
You can draw the the recived image parts to a bitmap in memory and in your OnPaint event draw that bitmap in the form
|
|
|
|
|
In VS .NET beta programs TrayAutoArrange was a property of System.WinForms.Usercontrol.......what is its equivalence in VS .NET Academic??
or if anyone knows where i can download VS.NET beta 2 or 3, I would appreciate if he/she can tell me.
|
|
|
|
|
Well, in my program, the user type the path of the image.
string with the path is: imagepath
I tryed:
Image img = Image.FromFile( imagepath );
but this ONLY WORKS if the IMAGEPATH ( users type ) is the SAME of the PROGRAM PATH.
If the program path is different, this doesnt work...
So i tryed a FileStream and Image.FromStream, same problem, only works if the program path = IMAGEPATH
What can i do?
Thanks.
|
|
|
|
|
Hi Moon B,
Image img = Image.FromFile( imagepath );
In place of "imagepath" you can enter
1. image file name with extension like "mypic.bmp", "mypic1.ico" etc or.
2. You can enter the image full path like
Image.FromFile(@"C:\Jay Code\mypic.bmp")
In Case 1 mypic should be in Application's Main/Bin/Debug folder where exe is being stored.
In case 2 it takes absolute bath that is why application directory does not matter.
Try the code mentioned in 2, if it does not work revert back..
Jay
|
|
|
|
|
Hi Guys,
I've created a program in c# that reads data from different port at the same time - so far it was ok connection to 5 ports at the same time using sockets. My concern now is if the administrator from one of the ports "KILL" or "TERMINATE" that particular port my program doesn't catch it. I'm using socketexcetopn as my CATCH and at the same time ObjectDisposedException still no luck. If you run NETSTAT from "cmd" you can see that the connection is "CLOSE_WAIT". What happen is that the connection will always be there. My program is running on 24hrs everyday.
I need to monitor that becuase if it's disconnected I need to reconnect it again.
CODE:
socketList[arrcnt] = new Socket(AddressFamily.InterNetwork,SocketType.Stream ,ProtocolType.Tcp );
IPAddress ip = IPAddress.Parse (stripd);
Int32 iPortNo = System.Convert.ToInt32 ( strport);
IPEndPoint ipEnd = new IPEndPoint(ip.Address, iPortNo);
socketList[arrcnt].Connect (ipEnd);
WaitForData(socketList[arrcnt]);
CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState ;
try
{
//end receive...
int iRx = 0 ;
iRx = theSockId.thisSocket.EndReceive (asyn);
if (theSockId.dataBuffer == null)
{
int sam = System.Environment.TickCount;
}
char[] chars = new char[iRx]; // + 1];
System.Text.Decoder d = System.Text.Encoding.ASCII.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
StringBuilder szData = new StringBuilder();
szData.Append(chars);
WaitForData(theSockId.thisSocket);
}
catch (ObjectDisposedException)
{}
catch(SocketException se)
{System.Diagnostics.EventLog.WriteEntry("ossrop on datareceived",theSockId.thisSocket.RemoteEndPoint.ToString() + " " + se.Message);
}
Any help or explanation will do. Thanks in advance.
/dabuskol
|
|
|
|
|
Hi,
I'm writting a program for pocketpc using c#. I need to call and execute another program. It looks like the compact framework doesn't have the class "process", so I can't use the System.Diagnostics.Process.Start(...)
Does anyone have a solution to this? Great thank for any suggestion.
|
|
|
|
|
The simplest thing to do is to grab the OpenNETCF class libraries, which contain a class OpenNETCF.Diagnostics.Process which almost exactly replaces the missing class. See OpenNETCF Smart Device Framework[^].
If you don't want to be dependent on third-party components, use P/Invoke to call the CreateProcess or ShellExecute APIs.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Have an Access DB A table called Zips and Field called zipcodes. I can get the data at the console.writeline but the combobox shows nothing. Any ideas.
private void property_Load(object sender, System.EventArgs e)
{
string strDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\ARM1\\database\\utility.MDB;Jet OLEDB:Database Password=rival";
string strSQL="Select * FROM zips";
//Connection Object
OleDbConnection connection = new OleDbConnection(strDSN);
OleDbCommand MyCmd=new OleDbCommand(strSQL,connection);
connection.Open();
OleDbDataReader rsZips=MyCmd.ExecuteReader();
ArrayList load = new ArrayList();
while(rsZips.Read())
{
load.Add(rsZips["zipcodes"].ToString());
}
this.comboBox1.DataSource=load;
comboBox1.DisplayMember="zipcodes";
for (int cnt = 0; cnt < load.Count; cnt++)
{
string anItem = load[cnt].ToString();
comboBox1.Items.Add(anItem);
Console.WriteLine(anItem);
}
connection.Close();
}
TIA Jim
|
|
|
|
|
Hi Jimbo,
If you getting the data at the console, The combo box should also get populated.
I suppose u do not require the code line
this.comboBox1.DataSource=load;
since u are traversing the data using for loop.
comment the line of code(this.comboBox1.DataSource=load;
)
U will get the result.
Do revert back if u are still unable to solve.
Jay.
|
|
|
|
|
This didn't work. The combobox seems to be populated but nothing appears.
Here is the code for the whole form. Maybe this can shed some light. Jim
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Data.OleDb;
using System.Data;
namespace mdisample
{
///
/// Summary description for property.
///
public class property : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label2;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public property()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.comboBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.panel1.Location = new System.Drawing.Point(8, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(600, 300);
this.panel1.TabIndex = 0;
//
// label2
//
this.label2.Location = new System.Drawing.Point(144, 56);
this.label2.Name = "label2";
this.label2.TabIndex = 2;
//
// comboBox1
//
this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Location = new System.Drawing.Point(288, 56);
this.comboBox1.MaxDropDownItems = 20;
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(216, 21);
this.comboBox1.Sorted = true;
this.comboBox1.TabIndex = 1;
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(248, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(304, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Please select the Zipcode you are looking for.";
//
// property
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(680, 273);
this.Controls.Add(this.panel1);
this.Name = "property";
this.Text = "Property";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.property_Load);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/*================================================
* Directory scanner Not used because we bind to the DB
* ===============================================*/
void DirToLbox(string targetPath, ListBox myListBox)
{
// create an array to hold the subdirectories
ArrayList sArray=new ArrayList();
// create an array to hold the list of files
ArrayList fArray=new ArrayList();
// get information about our initial directory
DirectoryInfo dirInfo=new DirectoryInfo(targetPath);
// retrieve array of files & subdirectories
FileSystemInfo[] myDir=dirInfo.GetFileSystemInfos();
for (int i=0; i<mydir.length; i++)=""
="" {
="" check="" the="" file="" attributes
="" if="" a="" subdirectory,="" add="" it="" to="" sarray="" otherwise,="" farray
="" (((convert.tobyte(mydir[i].attributes)="" &="" convert.tobyte(fileattributes.directory)="" )=""> 0 ))
sArray.Add(Path.GetFileName(myDir[i].FullName)
+ "\\");
else
fArray.Add(Path.GetFileName(myDir[i].FullName));
}
// sort the subdirectories alphabetically
sArray.Sort(0,sArray.Count,null);
// sort the files alphabetically
fArray.Sort(0,fArray.Count,null);
// ensure that the listbox has no items beforehand
myListBox.Items.Clear();
// insert the sorted subdirectories into the listbox
for (int i=0; i
|
|
|
|