|
Hello,
In my form application, i am having controls like ListBox, ComboBox and OK - Cancel buttons.
I want to get the proper combition of inserted item in ListBox and comboBox.
So when user press OK, if the combination is not proper the control should return to form to select the another combination.
To achieve this i handled the validating event of comboBox but now this does not give me chance to change the selection from ListBox unless and untill i change the selection from ComboBox.
How should i handle it.
Also if i am calling a method from OK button and if the method returns false the form should not be disposed.
Thanks.
gajesh
Pune(India)
|
|
|
|
|
Handle the Closing event of the Form. If the data in the controls is invalid, set e.Cancel to true. You can check the Form's DialogResult property to see which button was clicked (OK or Cancel).
Josh
|
|
|
|
|
I have a datagridview created. Is it possible to allow user to do a search on the data?
|
|
|
|
|
I know there is an article here on Code Project that lets the user basically create SQL statements to return records. I've been researching datagrids myself; if you search on it you will get lots of articles. It may take a little time to search through them, but chances are you will find what you need.
Also from what I understand, VS2005 will let you treat cells individually more easily rather than as an entire row like VS2003. So that may make a difference on how you decide to program.
Hope your search turns out well!
|
|
|
|
|
I've got an app that does heavy background processing off a user adjustable timer. If the tick rate is pushed too fast and all the CPU capacity is hogged by the background activity, or the app's running near the limit and annother process starts eating heavy cycles my app stops behaving well. The most prominant issue is that the form doesn't handle the OnPaint event. Is there an easy way to test that the event is being handled so that I can throttle the timer.
|
|
|
|
|
In source code, you can check by comparing that event against null. If the event is equal to null, it means corresponding event is not being handled. Otherwise, it is being handled.
|
|
|
|
|
You misunderstand what I need. The default event handler for OnPaint is installed, but if the other stuff my app does in the background is being called to rapidly the event handler never actually gets called. I'm using a high precision win32 timer that IIUC uses a high priority kernal thread to repeatedly check a high precision clock and fire events to my app. If it's set too rapidly (and too rapid depends on the cpu speed and it's background process load), the timer itself can consume 100% of my app's cpu time, and my apps OnPaint event handler stops being executed.
|
|
|
|
|
I might get you wrong, too, but why don't you just add your own method to the event handler, which for example saves the time when it was executed in a variable, that you can check in your code. You might also override the OnPaint method of your form to do the above procedure:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)<br />
{<br />
lasttimeexecuted = DateTime.Now;<br />
base.OnPaint(e);<br />
}
-- modified at 12:21 Wednesday 7th June, 2006
|
|
|
|
|
3Dizard wrote: I might get you wrong, too, but why don't you just add your own method to the event handler, which for example saves the time when it was executed in a variable, that you can check in your code.
That sounds like it should work. Apparently my brain's been thinking it's friday 4:30pm all day.
|
|
|
|
|
Hi Guys,
I need to read and write records in my C# app to a binary file like these
class myRecord
{
string filed1;
Int32 field2;
Int32 sizeOfData;
byte[] data;
}
or
[StructLayout(LayoutKind.Sequntial)]
struct myRecord
{
//Same thing
}
Actually I read sequentially record's fileds so I do sequentially calls to read string, Int32...with methods of BinaryReader, BymaryWriter classes.
What is the method/best way to read/write this type of data?There are tuts or examples on codeproject?
Thankyou a lot in advance.
Mirko
|
|
|
|
|
I'm trying to get my deployment project to automatically associate a certain file extension with my .exe.
When I run my installer, the program installs normally, and all files with my desired extension change to an icon representing my applcation. When I double click these files, my application loads as expected.
The problem is when I right click one of these files, and select open with. The icon is blank, and the description of the application used to open it is empty.
My question is, in the setup and deployment project, where is the area where I place a target icon and a description, so that it will show up on the "Open With" list of file associations?
Also does anyone know how to clean the "Recommended Programs" list in this menu?
Thanks,
-Chris
|
|
|
|
|
I am searching for some inspiration, just for fun, for extracting the Delta (changes) among two files and saving this in a fashion similar to Visual Source Safe in which the history might be viewed and recreated.
Anyone ever seen Java or C# code concerning this? My Google searches have not been successful.
Thanks all!
- Nick
|
|
|
|
|
Use the search box at the top of this site and enter "diff". CP has a lot of articles and sample code about this topic
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The Signature table holds the information that uniquely identifies a file signature.
The Signature table has the following columns.
Signature Identifier
FileName Text
MinVersion Text
MaxVersion Text
MinSize DoubleInteger
MaxSize DoubleInteger
MinDate DoubleInteger
MaxDate DoubleInteger
Languages Text
by keeping these information in mind, how these can be get through programming, so that we can use its signature with others signature mean spy signature
muhammad mahmood ilyas
|
|
|
|
|
|
Wjousts wrote: that's when you posted the same question about an hour and a half ago.
And there's this one too[^] when he posted the same question about an hour later.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
This really makes me angry. Is there some sort of shitlist for CP where I can ignore morons like him?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I did see someone who listed his offenders in his signatures. Once even referenced the post so you could see how rude the guy was. I wrote down the user names, but I lost the post-it. But I thought it was an interesting idea.
|
|
|
|
|
Stop asking the same question over and over again. It's already been answered multiple times! Noone is going to write your code for you, if that's what you are after.
Josh
|
|
|
|
|
I realy don't have much time, so please answer me quickly!
I need a simple example on how do I put the result of an sql query into a DataGridView.
|
|
|
|
|
Use
SqlConnection con=new SqlConnection(ConnectionStringBuilder.Make());<br />
string str_SQL ="SELECT * FROM Shop_ProDetails "<br />
SqlCommand cmd=new SqlCommand(str_SQL,con);<br />
SqlDataAdapter da=new SqlDataAdapter(cmd);<br />
DataTable tb=new DataTable("tb");<br />
da.Fill(tb); <br />
dgr_Products.DataSource=tb;
dgr_Products.DataBind();
|
|
|
|
|
|
How do I add the possibility to edit only one collumn of the generated table?
How do I add the possibility to delete rows?
Thanks!
|
|
|
|
|
If you search Google (or even Code Project) you'll probably find thousands of examples of databinding to a dataset to a datagridview.
andrei_dalcu wrote: How do I add the possibility to edit only one collumn of the generated table?
Set all other DataGridViewColumns ReadOnly property to true except for the one you want to edit
andrei_dalcu wrote: How do I add the possibility to delete rows?
In the DataGridView, AllowUserToDeleteRows should be set to true (which is the default) then when a user selects a row and presses delete the row will disappear. If you want to actually delete it from the database then you need to set up your DataAdapters DeleteCommand and when you want to delete you will need to use the Update method - again, try Google for lots of examples or even MSDNs documentation is pretty decent.
|
|
|
|
|
my application has a usercontrol that contains 3 panels.
there are a flash object on my main form , contains 3 button, i want hide and show that panel on usercontrol according to commands that falsh object send!!!
i call a method from usercontrol in my form that changes visibility of panels
but doesn't work.
Please Help me
on form :
<br />
private void AXSWMenu_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)<br />
{<br />
CtlSimpleHtml find_suitableAction =new CtlSimpleHtml();<br />
find_suitableAction.load_html(e.args.ToString());<br />
<br />
}
on usercontrol:
<br />
public void load_html(string command_type)<br />
{<br />
if (command_type.Trim()=="Bio")<br />
{<br />
fill_author_name_forBio();<br />
pnl_viewer.Hide();
pnl_Story.Hide();
pnl_AuthorName.Show();
pnl_AuthorName.Location=new Point(8,8); <br />
pnl_viewer.Location=new Point(8,672);<br />
pnl_AuthorName.Update();<br />
pnl_Story.Update();<br />
pnl_viewer.Update(); <br />
}<br />
}<br />
<br />
public void fill_author_name_forBio()<br />
{<br />
Authors name =new Authors();<br />
DataTable Authors_name=name.find_AuthorsName_all(connection.make());<br />
li_AuthorName.DataSource=Authors_name;<br />
li_AuthorName.DisplayMember="Name";<br />
li_AuthorName.ValueMember="id";<br />
li_AuthorName.SelectedIndex=-1;<br />
}<br />
In Classes:
Authors:
<br />
public class Authors<br />
{<br />
OleDbConnection con;<br />
OleDbCommand cmd;<br />
public DataTable find_AuthorsName_all(string cnstring)<br />
{<br />
con=new OleDbConnection(cnstring);<br />
try<br />
{<br />
con.Open();<br />
string cmdstr="select name,id from Authors ";<br />
cmd=new OleDbCommand(cmdstr,con);<br />
cmd.CommandType=CommandType.Text;<br />
OleDbDataAdapter adp=new OleDbDataAdapter(cmd);<br />
DataTable dt =new DataTable("Authors");<br />
adp.Fill(dt);<br />
con.Close();<br />
return dt;<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
con.Close();<br />
return null;<br />
}<br />
}<br />
}<br />
|
|
|
|