|
You can't have the same shortcut assigned to different actions. You need to supply a different shortcut.
|
|
|
|
|
Thanks
Have Fun
Never forget it
|
|
|
|
|
Hi,
i'm trying to Lock The Form so that the user would'nt be able to Move it
How can i Do It, i'd tried a variaty of properties, non helped
any Suggestions
Have Fun
Never forget it
|
|
|
|
|
Set the FormBorderStyle property to FormBorderStyle.None
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Thanks A Lot
I Never Thought to Try This Thanks Again
Have Fun
Never forget it
|
|
|
|
|
Or if you want to keep the titlebar and other stuff:
class Form1
{
Point pos;
public Form1()
{
InitializeComponent();
this.Pos=new Point(this.Left,this.Top);
this.Move+=Form1_Move;
}
void Form1_Move(object sender, EventArgs e)
{
this.Left=pos.X;
this.Top=pos.Y;
}
}
|
|
|
|
|
Thanks
Have Fun
Never forget it
|
|
|
|
|
I want to define the object type in the ArrayList to be string - i dont want to leave is as Object.
How to do it ?
|
|
|
|
|
You can't do this in ArrayList. Use List<string> instead
|
|
|
|
|
You could just use a string[] array, or use List<string>...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I want to create ActiveX Control for my windows application....
how can i do that..Bcoz i'm the new one for ActiveX.......
|
|
|
|
|
Check the following link:
http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx
~Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
hi Dave
Thank u for ur reply..Here the example is simply good i can understand....
But i want to post my ActiveX application to Internet is this example is correct for that one or not........
|
|
|
|
|
Hi Guys. I have read in a few post about this but for the life of me I can't find any of them and have tried searching the posts about this but don't get any results returned.
I have an application that reads data and writes that data to an Excel sheet. Problem I have is that when I change to another application while the process is running and return to the form it just shows a blank white form with just the progressbar and percentage updating.
Now, I know I can put the other process into a sepperate Thread but that means me chasnging the whole layout of my application as the work is done in a button even.
Is there any other way I can get the form to refresh and to show me the form properly?
Thanks in advance.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Yes there is but I wouldn't recommend it. You should put long running process in a separate thread and not in a button click event for several reasons. It will make your GUI responsive, the code will be designed and structured in much more better way.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
So, basically without re-working the whole app there is no chance?
Just to clarify, I have been reading up on Threads and from what I read it doesn't seem to be that easy to work with but it doesn't seem that diffcult though. So, I would just have to declare a new Thread, call this Thread in the button event and away it goes?
I'll try and move the stuff around a bit to see what I can do about this. Hopefully I get it to work with no hastles.
Thanks mate for the reply
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Kwagga wrote: So, basically without re-working the whole app there is no chance?
You can use Application.DoEvents() but I would highly discourage from doing so.
Kwagga wrote: Just to clarify, I have been reading up on Threads and from what I read it doesn't seem to be that easy to work with but it doesn't seem that diffcult though. So, I would just have to declare a new Thread, call this Thread in the button event and away it goes?
Threads aren't very easy topic but they are quite powerful and it's worth studying it. If you need to do simple work you can use BackgroundWorker class. Here is a more in depth explanation about threading concepts: Threading in C#[^]
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi Giorgi. I ahve moved the code into a new thred but I get an error on the progressbar. Error details as below.
System.InvalidOperationException was unhandled<br />
Message="Cross-thread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on."<br />
Source="System.Windows.Forms"<br />
StackTrace:<br />
at System.Windows.Forms.Control.get_Handle()<br />
at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, Int32 lparam)<br />
at System.Windows.Forms.ProgressBar.set_Maximum(Int32 value)<br />
at NomConv.Form1.RunExcel() in C:\Documents and Settings\mumbleb\My Documents\Visual Studio 2008\Projects\NomConv\NomConv\Form1.cs:line 118<br />
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
at System.Threading.ThreadHelper.ThreadStart()<br />
InnerException:
Now, this is what I'm doing. I'm calling the Thread in the button event as below.
private void btnRun_Click(object sender, EventArgs e)
{
Thread excelrun = new Thread(RunExcel);
excelrun.Start();
lblPercent2.Visible = true;
lblRecordProcessed.Visible = true;
lblProgText.Visible = true;
progressBar1.Visible = true;
lblProgress.Visible = true;
}
And then the code from the new class.
private void RunExcel()
{
string filepath;
filepath = txtboxSelectTxtFile.Text;
FileHelperEngine<ReadFile> engine = new FileHelperEngine<ReadFile>();
engine.ErrorManager.ErrorMode = ErrorMode.SaveAndContinue;
ReadFile[] res = engine.ReadFile(filepath, 1);
ReadFile[] mes = engine.ReadFile(filepath);
int progrval = 0;
progrval = progressBar1.Value;
progressBar1.Minimum = 0;
progressBar1.Maximum = engine.TotalRecords;
Any idea what I should do? I have tried moving the code for the progressbar around and I get all sorts of errors on it.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You can't access controls from another threads. To manipulate them from other thread use Invoke method of ProgressBar class.
Giorgi Dalakishvili
#region signature
my articles
#endregion
modified on Tuesday, June 10, 2008 12:22 PM
|
|
|
|
|
|
Yes that is one of the possible solutions.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I'm trying to make a splash screen with the following requirements:
1) Must fade in and fade out (issues)
2) Fades in before main program form is open and fades out once it is (done this)
3) Displays an image which is not squash and has transparency (issues)
So I've looked on the net and I'm still struggling with some aspects if anyone can assist. Fading the form is trivial (by setting the Opacity), however getting a form to be transparent (to work with the pictures transparency) and then fading that in and out is a mess.
I have tried numerous methods, such as overriding OnPaintBackground, changing the style of a form to allow a transparent background and a few other things. The problems I hit are:
- When fading the transparent form, by changing the Opacity the transparent bits turn black
- When the splash screen first shows it paints properly, but when the main form is finally loaded the transparent bits of the splash screen still show what was there before the form loaded (i.e. not repainting or something).
At the moment some of the code I have looks like this:
protected override void OnPaint(PaintEventArgs e)
{
}
protected override void OnPaintBackground(PaintEventArgs e)
{
Console.WriteLine("paintBackground");
Graphics gfx = e.Graphics;
gfx.DrawImage(global::DesktopLiveDotNet.Properties.Resources.splash_screen, new Rectangle(0, 0, Width, Height));
}
But when it starts to fade the transparency turns black:
private void timer1_Tick(object sender, EventArgs e)
{
Opacity = fOpacity / 100;
Application.DoEvents();
fOpacity -= StepVal;
if (fOpacity <= 0)
{
timer1.Stop();
Close();
}
}
Not quite sure how to proceed and any ideas would be great!
|
|
|
|
|
I have never been able to use BackGroundpainting successfully. Why not just paint normally?
|
|
|
|
|
I've tried that.
My problem is making the form's background disappear. I cannot get rid of the grey square (default form background color). So to do that I override the paintbackground method but that then draws black wherever the transparency is meant to be. Whether double buffered or not. It definitely draws black in the transparency when changing Opacity :/
|
|
|
|
|
i have stored procedure with two parameters as follows:
create procedure checkCompatability
(
@compatility varchar output,
@award_num int
)
AS
SET NOCOUNT OFF;
IF EXISTS (SELECT Award_num from table1 where award_num=@award_num)
begin
set @compatability='Y'
print @compatability
end
else
set @compatability='N'
print @compatability
GO
in C# parameters:
SqlCommand checkDone = new SqlCommand();
checkDone.Connection = con1;
checkDone.Connection.Open();
checkDone.CommandType = CommandType.StoredProcedure;
checkDone.CommandText = "checkCompatability";
SqlParameter comp = new SqlParameter("@compatability", SqlDbType.VarChar);
string S = comp.Value.ToString();\\null reference exception occours here
lblresult.Text = S.ToString();
comp.Direction = ParameterDirection.Output;
SqlParameter complete = new SqlParameter("@award_num", SqlDbType.Int);
complete.Direction = ParameterDirection.Input;
int awN = int.Parse(comboAwardNum.Text);
complete.Value =(int) awN;
lblresult.Text = comp.Value.ToString();
checkDone.Parameters.Add(comp);
checkDone.Parameters.Add(complete);
checkDone.ExecuteNonQuery();
checkDone.Connection.Close();
what is the problem with that code?
|
|
|
|