|
Yeah, that is what I was going to do. I just didn't know if there was a better way of doing it. Thanks for your help.
|
|
|
|
|
Hey,
I wanna display an image on the background of a form...thats easy enough, just set the form.backgroundimage to the image.
The problem is I also want to to scroll down the image if its bigger than the form, i set form.autoscroll to true, yet I still can't scroll down, up or side to side.
How can I sort this out, or what control would work better, the picture box control poses the same problem.
Thanks for the help
|
|
|
|
|
hi!
In the ShowDialog, is there a way to set the modality of the form into a parent form only not to the whole application?
i used the ShowDialog(IWin32Window) overload, still it's application modal.
but if i use the Show method and disabled the Parent form this solves the problem, but the process of the parent continues after the form is shown. Unlike in the ShowDialog, it freezes the parent's process until you close the modal form.
so is there any way to make this somewhat a combination?
- Form Modal
- freezes the parent's process when the modal form is shown & resumes when it's closed.
any suggestions is very much appreciated.
thanks in advance!
|
|
|
|
|
i think this can be solved by making the parent form as MDI and
the form that u want to display as the MDI child of the parent form.
hope that works for u
Regards,
Pramod
|
|
|
|
|
the child form is like a messagebox. that shows message, only modal to the owner/parent form and executes the next statement of the owner after it's close.
that's why it doesn't solves my problem.
i don't use the .Net's messagebox because i want some other controls on it.
anyway, thanks for your reply!
i really appreciate it!
|
|
|
|
|
What actually are u trying to do?
if u are using a form to display the message then u can
make that message form as the MDI child of the form from
where u are calling this message form.
if u can explain ur problem in more detail..
Regards,
Pramod
|
|
|
|
|
hi pramod!
sorry for the late reply.
actually, my main goal is to create a custom message box. I don't want to use the normal messagebox because it's very limited with regards to functionality and design. that's why i just created a normal form.
i already read some articles about making a custom messagebox and most of them are using the ShowDialog method. Which is ok because it will become modal to the owner form and the next statement after the showing of the messagebox is executed after the messagebox is closed.
but there is a problem in this method... the modality of the messagebox is for the whole application not for the owner only.
for example, i have 2 forms in the application, Form1 and Form2. Both of them are loaded.
the Form1 shows the messagebox, which means it's the owner and you cannot access it until you close the messagebox. So Form2 must be accessible, but this is not what happen. both of the forms are not accessible.
there's an overload of the ShowDialog which has an IWin32Window parameter for setting the owner. but it's the same as the one with no parameter.
so as a solution for the modal thing, i just set the owner of the messagebox, then use the Show method and disabled the owner. but there's a problem with this(again?
the execution of the statements, after showing the messagebox, continues even if the messagebox is stil loaded.
so as a summary, here's what i want(if possible... )
Option 1
- Use ShowDialog method
- Set the modality of the messagebox to the owner only (how???)
Option 2
- Use Show method and disabled the owner
- freeze the process of the owner until the messagebox close (how???)
hope that explains well...
thanks for your time!
microsoc
|
|
|
|
|
The first thing that i would like to know is y do u want to display 2 forms at one time in ur application. I think the flow should be such that only one form is accessible at one time.
But even then if u want to do it then it seems to be a tricky one
need to try this
i'll try if this is possible and then let u know
Regards,
Pramod
|
|
|
|
|
Hi,
can u tell me from where does ur form 2 gets the call to
display?
if it's from form1 then u cannot solve it
but if form2 is called from some other form u can access it.
Please send the details what is ur application about
i have tried it.
Regards,
Pramod
|
|
|
|
|
thanks for your reply!
Actually, it's a windows application but Internet Explorer hosted so the one that loads the forms is the IE.
there will be an instance/scenario that you want to open more than one forms at a time, for some transaction purposes to validate some data. Anyway, so for example there would be an error occured or a message asking for confirmation for something in one of the openned forms(that's where the messagebox comes in the picture), then when you don't want to close the messagebox yet and go to the other forms or launch another, you can't do that because the messagebox is modal for the whole application.
so that's the purpose of the customized messagebox.
hope that's what you want to know.
thanks for your time!
microsoc
|
|
|
|
|
I'm looking for any topic or code that can help me understand xls parsing. I'm trying to read from excel file, re-format some data and save it to xls file again. I'll be really really thankful for any kind of help.
|
|
|
|
|
http://swish-e.org/archive/2005-06/9778.html
|
|
|
|
|
Hello everybody,
I've created a filesystemwatcher in windows service. I want to store files that have been changed into MS Access. The problem is the data is not inserted into database after the event handler is fired. Any suggestion that can solve this problem?
Thanks in advance,
hongweng
|
|
|
|
|
If you pop a break point in the event handler, is it actually getting fired? One thing I found, especially with MS Word files, is that some applications use temporary swap files that get copied over the original file (the $WSwhatever.doc files in word, for example). This raises a Rename event on the fileSystemWatcher rather than a save.
|
|
|
|
|
I am working on a web chat application that is using Sockets. when a client application recieves message from server application its method is call back named OnDataRecieved(IAsyncResult asyn). but when data is recieved on the client side it does not show tha value of data recieved in textbox, the reason behind is that page is not being refreshed. OnDataRecieved() method is as follows:
public void OnDataReceived(IAsyncResult asyn)
{
try
{
SocketPacket theSockId = (SocketPacket)asyn.AsyncState ;
int iRx = theSockId.thisSocket.EndReceive (asyn);
char[] chars = new char[iRx + 1];
System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
System.String szData = new System.String(chars);
bool chk = false;
//
if (szData=="|\0")
{
chk_list=false;
Object objData = '~' + txtname.Text + '\n';
byte[] byData = System.Text.Encoding.ASCII.GetBytes(objData.ToString ());
if(m_clientSocket != null)
{
m_clientSocket.Send (byData);
}
}
else
{
if (chk_list==false)
{
listBox1.Items.Clear();
chk_list=true;
}
if (szData== "~\0")
{
chk = true;
chk_msgtype=true;
}
//
if (chk == false)
{
str+=szData[0];
}
if (szData=="\n\0")
{
if(chk_msgtype == true)
{
listBox1.Items.Add(str.ToString());
chk_msgtype=false;
}
else
{
if (richTextRxMessage.Text!="")
{
/*richTextRxMessage.Text += str;
a.Text=str;
Label1.Text = "1234";*/
Session.Add("message",str);
Response.Redirect("SocketClient.aspx");
//Response.Write(str);
}
else
richTextRxMessage.Text=str;
//richTextRxMessage.Text+="\n";
}
str="";
}
}
WaitForData();
}
when this method calls Response.Redirect("SocketClient.aspx"); it provides followingg error.
An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll
Additional information: Response is not available in this context.
I want my page to be postback after this method is called but response.redirect is not working. can anybody tell me y isnt it working and how can i perform the same task
|
|
|
|
|
Have you tried System.Web.HttpContext.Current.Response.Redirect("SocketClient.aspx")?
|
|
|
|
|
That won't help.
The problem is not that the Response object isn't reachable, the problem is that it's not available at all.
The Response object is only available in code that is actually creating a response.
---
b { font-weight: normal; }
-- modified at 3:49 Tuesday 24th January, 2006
|
|
|
|
|
the problem is there is no request generated, but i want my page to be rereshed from but i dont know how and i want ideas to do that
|
|
|
|
|
Hi,
I want the code in C# for pinging the system constantly and get back the alert when the target system is down which says that "Service Unavailability" of the target computer. Kindly guide me in solving this issue.
Thanking you in Advance,
Venkat.
|
|
|
|
|
the ping command of the system returns
"Reply from ..." if the system that is pinged is working or on.
and returns
"Request Timed out.." if the system is \switched off
now u need to write a thread and execute this ping command in that thread
and break the thread when u receive the Request timed out message
and display that to the user.
Regards,
Pramod
|
|
|
|
|
|
Hi, howzit.
I have a 2003 solution that I trying to open in VS 2005 but it keeps giving me this error message:
"Cannot be converted because it cannot be modifyed. To convert it change the permissions on the solution file to allow modification and re-open it"
How do I change the permissions on the solution file?
Thanks,
|
|
|
|
|
Check to see if the file is read only.
|
|
|
|
|
I tried that the first time, but it obviously did not change all the files to read/write, but now when I tried again it works, thanks man!
|
|
|
|
|
Hi, I have created a program first as a console application. Then I created a windows application and copied the class data there. It is shown below. In the console application, I have used the printData() method to output the data of an instance of a Person or Athlete class. I want to do the same, but now that output should be in the label. I have created the printWindows data() function but when I call it from the main function in the for loop it doesn't work.
Any help would be appreciated.
namespace windowsPracticingWithClasses
{
///
/// Summary description for Form1.
///
public class Person : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
//My instance variables
private string firstName, lastName;
private int age;
private double height, weight;
private string bankName;
private double bankAccount;
private double balance = 0;
private string squareColor;
# region Properties
//Properties
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
and other properties.....
#endregion
//Custom constructor
public Person(int age, double height, double weight, string bankName, double bankAccount, double balance)
{
InitializeComponent();
this.age = age;
this.height = height;
this.weight = weight;
this.bankName = bankName;
this.bankAccount = bankAccount;
this.balance = balance;
}
public virtual void printData()
{
Console.WriteLine("\nProfile: \n\nAge: " + this.age);
Console.WriteLine("Height: " + this.height);
Console.WriteLine("Weight: " + this.weight);
Console.WriteLine("Bank Name: " + this.bankName);
Console.WriteLine("Bank Account: " + this.bankAccount);
Console.WriteLine("Balance: " + this.balance);
}
public void printWindowsData()
{
label1.Text += "Age: " + this.age;
label1.Text += "\nHeight: " + this.height;
label1.Text += "\nWeight: " + this.weight;
label1.Text += "\nBank Name: " + this.bankName;
label1.Text += "\nBank Account: " + this.bankAccount;
label1.Text += "\nBalance: " + this.balance;
}
class Athlete : Person
{
public string sport;
public Athlete(string sport) : base(23,5.6,120,"Chase",5671234,1000)
{
this.sport = sport;
}
public override void printData()
{
base.printData();
Console.WriteLine("Sport Practicing: " + this.sport);
}
};
class TestClasses
{
[STAThread]
static void Main()
{
Application.Run(new Person());
Person[] person = new Person[5];
person[0] = new Person(22,5.6,120,"Chase",5671234,2000);
person[0].printData();
Person[] athlete = new Athlete[3];
athlete[0] = new Athlete("Martial Arts");
athlete[0].FirstName = "Kim";
athlete[0].LastName = "Chung";
athlete[0].Age = 21;
athlete[0].Height1 = 5.7;
athlete[0].Weight = 130;
athlete[0].BankName = "Citi";
athlete[0].BankAccount = 212312;
athlete[0].Balance = 300;
for (int i = 0; i < athlete.Length; i++)
{
athlete[i].printWindowsData();
}
|
|
|
|