|
If you set panel.Visible = false, then all controls in that panel will be invisible too.
|
|
|
|
|
i'm using the visible poperty to hide the panel but it doesn't hide the controls on the panel.
is there any other way other than through the visible property.
|
|
|
|
|
Hi, Everyone
I have bound dataGrid1 with using dataset1.
kindly help me about mentioned two problems:
1) when I click on any cell. it is already set with edit mode. How may I turn off edit mode?
2) When I bind dataGrid1 with dataset1, after loading project i have to collap it manualy. Why does it not collap automatic?
please give solutions about said problems.
thank you
My source code
==============
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private DataTable dataTable1;
private OleDbConnection oConnOLEDB = new OleDbConnection();
private OleDbDataAdapter oAdapter1 = new OleDbDataAdapter();
private OleDbDataAdapter oledbSelectCMD = new OleDbDataAdapter();
private DataSet dataset1 = new DataSet();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
oConnOLEDB.ConnectionString = "Provider=MSDAORA.1;Data Source=ORVB;Persist Security Info=True;User ID=RIAZ;Password=SMS";
oConnOLEDB.Open();
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button1_Click(object sender, EventArgs e)
{
String strSQLCommand = null;
strSQLCommand = "SELECT * FROM ADMIN.SCHEDULE ORDER BY TDATE DESC";
dataset1.Clear();
oAdapter1 = new OleDbDataAdapter(strSQLCommand, oConnOLEDB);
oAdapter1.Fill(dataset1, "SCHEDULE");
dataGrid1.SetDataBinding(dataset1, null);
}
}
}
|
|
|
|
|
1) Make your datagrid readonly
2) Use DataSet.Tables[0].DefaultView.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
dear all,
i have created an arrylist in one class i add object to it from the same class.
how can i remove object from the same arraylist from another class if u have any piece of code please do provide me.
thanx alot
flavour of life
|
|
|
|
|
You probalby need to post some code. The best way to do this is to have the class that exposes the arraylist to expose methods to add and remove items. Or use delegates to send a message to the class in question.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
You must have a reference to arrayList in Class1 in Class2.
Sample:
using System;
using System.Collections;
class Program
{
static void Main(string[] args)
{
MyClass1 myClass1 = new MyClass1();
myClass1.AddABC();
MyClass2 myClass2 = new MyClass2(myClass1.MyArrayList);
myClass2.RemoveABC();
}
}
public class MyClass1
{
private ArrayList arrayList = null;
public MyClass1()
{
this.arrayList = new ArrayList();
}
public void AddABC()
{
this.arrayList.Add("ABC");
}
public ArrayList MyArrayList
{
get { return this.arrayList; }
}
}
public class MyClass2
{
private ArrayList arrayList = null;
public MyClass2(ArrayList arrayList)
{
this.arrayList = arrayList;
}
public void RemoveABC()
{
this.arrayList.Remove("ABC");
}
}
|
|
|
|
|
Hi
The simplest way is declare the ArrayList as public static and access directly through the class name.
Chandru
|
|
|
|
|
ChandruIT wrote: The simplest way is declare the ArrayList as public static
I suggest you look up the term "encapsulation"
|
|
|
|
|
I want to create a directory using post build event at a specified path before copying my files into that directory. presently, i am facing a problem of post build error, if directory does not exist. I want to provide a command in post build to create directory first then it should copy.
Thanks in advance
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
MKDIR [path] will create a directory with the specified path.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
How can I remove a method from System.Collections.CollectionBase?
Say, I have a class:
public class MyList : System.Collections.CollectionBase{}
I have all the members of the collection base such as Add(object), Remove(object), RemoveAt(index), etc...
I want to get rid of RemoveAt() and Insert() methods..
Do you have a solution?
Thanks in advance..
Radgar
|
|
|
|
|
You can't remove methods that you inherit.
You can override them with methods that throws InvalidOperationException, or you can encapsulate the collection in a class that only exposes the methods that you want.
---
Year happy = new Year(2007);
|
|
|
|
|
You have a couple of options:
1. Do not derive from CollectionBase and instead implement ICollection and/or IList directly. This will allow you to either not include undesirable insertion/removal methods or, where those methods are required by the collection interfaces, to throw a NotImplementedException.
2. Derive from CollectionBase but override the protected OnInsert() and OnRemove() methods and throw a NotImplementedException. (You have to be careful with OnInsert(), though, as that will also get called for Add(), which you *do* want to allow.)
-Phil
|
|
|
|
|
Thank you for your responses.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
My problem is in this line of code: strResponse = wcDownload.OpenRead(UpdateUrl);
the variable strResponse receives a null value, and blows up.
I know I am going to need to figure out how to handle this exception, I know the url i am trying to access works because earlier in the code i check the modified date with today's date and it calls this method.
Here is my download method
private void Download()
{
using (WebClient wcDownload = new WebClient())
{
try
{
// Create a request to the file we are downloading
webRequest = (HttpWebRequest)WebRequest.Create(UpdateUrl);
// Set default authentication for retrieving the file
webRequest.Credentials = CredentialCache.DefaultCredentials;
// Retrieve the response from the server
webResponse = (HttpWebResponse)webRequest.GetResponse();
// Ask the server for the file size and store it
Int64 fileSize = webResponse.ContentLength;
// Open the URL for download
strResponse = wcDownload.OpenRead(UpdateUrl);
// Create a new file stream where we will be saving the data (local drive)
strLocal = new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.None);
// It will store the current number of bytes we retrieved from the server
int bytesSize = 0;
// A buffer for storing and writing the data retrieved from the server
byte[] downBuffer = new byte[2048];
// Loop through the buffer until the buffer is empty
while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
// Write the data from the buffer to the local hard drive
strLocal.Write(downBuffer, 0, bytesSize);
// Invoke the method that updates the form's label and progress bar
this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { strLocal.Length, fileSize });
}
}
finally
{
// When the above code has ended, close the streams
strResponse.Close();
strLocal.Close();
UpdateFlag = false;
}
}
|
|
|
|
|
Hi Guys,
There is a requirement of handling the os events like logging off and mouse scroll events with the c# .Is there any way out?
saurabh walia
|
|
|
|
|
I have no idea what you mean. Do you want to write a windows hook so you capture events outside your program ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Is it compulsary to have a abstract method in abstract class?
Ravi
|
|
|
|
|
hi,
Good Morning,
it is not compulsory to have abstract method in abstract Class;
check with this example and give reply
public abstract class TestClass
{
public void display()
{
System.Console.WriteLine("Hello World");
System.Console.Read();
}
}
class SampleTest: TestClass
{
public static void Main(string[] args)
{
//TestClass t1 = new TestClass();
SampleTest s = new SampleTest();
s.display();
}
}
WIINING IS NOT OUR DREAM,IT'S A HABIT
HAVE A NICE DAY
|
|
|
|
|
Thanks its working without an abstract method
|
|
|
|
|
hi All,
I want to known when we go for Abstract and Interface concepts,
What are the features of Interfaces,
How it is differ from ABstract.
Pls give clarification.
Have a nice day
|
|
|
|
|
Dronala,
Abstract classes can have definitions for some of the methods while interface will never have a definition for any method. By default all members in interface are public and you can not modify it. In abstract class this is not the case. You can have any type of access modifier. You can use abstract class where you would like to provide definition for some method in base class itself and those should not be changed by its Childs. You can use interfaces if you want to implement more than one interface and give flexibility to the implementer to decide the behavior of all methods.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
I think this is going to be a hard one...I am using C#
I have this in each of my control's MouseDown and MouseMove events:
Private int Ox , Oy ;
Private Sub BackDiag_MouseDown(object sender, MouseEventArgs e)
{
Ox = e.X;
Oy = e.Y;
}
Private Sub BackDiag_MouseMove(object sender, MouseEventArgs e)
{
ControlName.Left = ControlName.Left + (e.X - Ox);
ControlName.Top = ControlName.Top + (e.Y - Oy);
}
I can click on any control with that code and move it around at run time and it works great. Now I want to be able to select multiple controls on my form at runtime and move them in the same manner. The ideal solution would be to be able to select them as a group by drawing a square around them with the mouse (like you do when selecting multiple icons on your desktop) and also be able to add to the selection 1 at a time by holding down ctrl and clicking on them with the mouse (also like you do with icons on the desktop) and move them around as a group. That may be asking to much, so if I can't have it that way, then 1 or the other will work.
If you have any questions, please ask.
Arjun Munda
|
|
|
|
|
Hi All,
I am trying to dynamically create object based on values that being submited from a form, but keep on getting a "No parameterless constructor defined for this object." error.
<br />
Type paramType = Type.GetType("System." + Request["type"]);
String paramValue = Request["val"];
<br />
if (paramType != null)<br />
{<br />
Activator.CreateInstance(paramType);<br />
}<br />
|
|
|
|