|
hello,every expertist
From debug the program, System shows if(dr.read()) == false, by the way, sql sentence is correct, test in SQL2005 Successfully!
i really confused, help me! Thank you!
private void button13_Click(object sender, EventArgs e)
{
if (this.textBox1.Text.Length > 11)
{
MessageBox.Show("please input correct number ",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.textBox1.Clear();
}
else if(this.textBox1.Text.Length < 11)
{
MessageBox.Show("please input correct number ", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.textBox1.Clear();
}
else
{
string sql = "select * from customer_colorring where cmobilephone ='" + this.textBox1.Text + "'and documentfile = 'g:\\song\\when i meet you.mp3'";
CDBSql q = new CDBSql();
SqlDataReader dr = q.getDataReader(sql);
if (dr.Read()) //here shows false,why????????????????????????????????????
{
string file = q.getScalar(sql).ToString();
Media.MP3Player mp3player = new Media.MP3Player();
mp3player.Open(file);
mp3player.Play();
mp3player.Pause();
mp3player.Stop();
mp3player.Close();
}
else
{
MessageBox.Show("no songs","error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
|
|
|
|
|
Try adding a space in "'and
|
|
|
|
|
Hello !
I'm a Chinese, i want to know how to use checkbox in datagridview. For example, there are 10 records in the datagridview, and i want to delete or modify them by clicking checkbox and a button. the checkbox is used for selecting the records,the button is used for deleting the records, i don't know how to write the codes.
if you know,please tell me, Thank you very much!
My e-mail address is : xurf@js.chinamobile.com
|
|
|
|
|
bozin wrote: i don't know how to write the codes.
What is going on here? Has someone outsourced this project to you? What are the requirements?
led mike
|
|
|
|
|
hello,led mike
no,i just do an exericise, not a project. simply speaking, i added checkbox to the datagridview checkboxcolumn, and when the checkbox is checked,and press "delete" button, the selected record will be deleted.
i want to know how to write the codes? if i write codes for "delete" button
private void button1_Click(object sender, EventArgs e)
{
// here i can't find the something about checkbox,so i have no ways to continue!
}
|
|
|
|
|
bozin wrote: no,i just do an exericise
Are you working through some sort of tutorial or Article? If not you should be, there will be many on the internet probably even some articles here on CodeProject.
led mike
|
|
|
|
|
i do that stuff (delete/add/edit row) directly to the database! sql server database (or a xml file!).
for exemple i delete a row in the database (not in the dgv) and afterwords refresh the dgv.
there´s no sense to me, to add or delete records in the dgv you know.
See you can do that but when you run the application other time the changs aren´t there so like i said i edit the database (not the dgv) and after i refresh dgv everytime i do my changes.
about the buttons, create a panel and place inside the dgv and a toolstrip with buttons for the operations you want, and textboxes for each column in the dgv, these textboxes will get the current row data, ok? here the id textbox get´s the current row (selected row in dgv) so that´s a easy way to get the row selected better that checking boxes.
little of coding there
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi all,
I have created an Excel 2003 AddIn project and created one Setup project also for install the AddIns in target machines. My setup contains the primary out put of the AddIn project. I just came to know some registery entries are required for successful installation. Can any one help me in creating setup project with necessary registery entries.
|
|
|
|
|
using keypress iam handling user not to allow any special characters in the textbox
now how can i disable paste event for the textbox
|
|
|
|
|
Supress Ctrl + V keypress for the textbox and re-initialize its context menu.
|
|
|
|
|
You will have to research overriding the WndProc function when inheriting from a textbox control.
Regards,
Thomas Stockwell
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.
Visit my Blog
|
|
|
|
|
MSDN DataGridView VirtualMode with caching sample code DataRetriever loads two pages always to cache thus making 2 database accesses.
If datagridview uses one page of data, second page retrieval is unnessecary and makes DataGridView display 2 times slower.
How to change this sample code so that only one page is loaded initially and second is loaded on real demand only ?
How to change this code so that it allows more than 2 pages of cached data? 2 page limit seems to be hardcoded into this page.
Or is there some other sample code which has solved those issues ?
Andrus.
Andrus
|
|
|
|
|
hello fellas and programmers,
hi,i am working on an application which stores details in a database and then displays on a datagrid.how can i then print the info/details from the datagrid.pls reply with an example showing the codes used or rather if u have an application displaying the codes in a pdf file, i'll reaLLY APPRECIATE it. Thank you.
topzturvy
|
|
|
|
|
There are two issues :
1. My windows application contain many number of controls like, buttons, textboxes,checkboxes etc..
Application is very slow while execution and even for any button click event application hangs for a while(atleast 8 seconds).
Used panel and group box but same status.
2.While execution i have to show one progress bar for particular button click event. And need to increment progress bar in sync or simultaneously with button click event execution.
Example: (only a part of the code i am writing here in blog):
Two forms form1 & form2:
on form1 button click event some code is executed.
say form1 code:
form2 trs = new form2();
btn_click
{
trs.Show();
trs.Owner = this;
trs.go(this);
Thread thred = new Thread(new ParameterizedThreadStart(trs.go));
string strngmain = "a";
....do something........(here actual code executes, while this executes,i want to show the status in progress bar, so while execution i am adding one char to string variable strngmain)
}
written one method in 1st form:
public void UpdateProgress(int progress)
{
if (InvokeRequired)
Invoke((MethodInvoker)delegate() { trs.progressBar1.Value = progress; });
else
trs.progressBar1.Value = progress;
}
where 'trs' is a instance of form2 declared in form1.
No. of times 'a' char is added in single button click event to a string declared called "strngmain". And depending upon each char progress bar status should get incremented in 2nd form.
Form2: It contains one progress bar which should increment depending upon the button click event execution:
Code in form2:
form2_load
{
progressbar1.show();
}
public void go(object param1)
{
MainForm form = (MainForm)param1;
string strng;
srtng = ((MainForm)this.Owner).trans_complete;
foreach(char c in strng)
{
form.UpdateProgress(10);
Thread.Sleep(10);
}
}
But the above code is not working correctly , progress bar is not incrementing in sync with mainform's button click event code execution.
Any help appreciated.
Thanks in advance.
|
|
|
|
|
You are going about it in the wrong way. Look into using a BackgroundWorker. It is meant to due computations in the background and relaying progress information to the GUI without freezing the application for awhile.
Regards,
Thomas Stockwell
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.
Visit my Blog
|
|
|
|
|
I am calling many functions in single function which i have written in DoWork event of backgroundworker. I am getting exception while calling multiple functions.
exception : "Cross-thread operation not valid: Control 'MainForm' accessed from a thread other than the thread it was created on."
Is this backgroundworker supports this kind of requirement of calling multiple functions?
Thanks in advance
|
|
|
|
|
Hi,
I'm using a SplitContainer. The left panel contains an image, the right panel contains a ListView control which can be enabled or disabled by the user. When disabled, panel2 collapses. When collapsed, if the right border of the app is dragged to the right, panel2 displays garbage information which appears to be pieces of the desktop image that is actually behind the window. The background color is set to "control" for all windows so I have no idea why it behaves this way.
Any insights are appreciated.
-- Greg
|
|
|
|
|
If the problem is happening when the application window is resized (extended from the right side), why don't you just make the form so it is not resizeable?
Regards,
Thomas Stockwell
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.
Visit my Blog
|
|
|
|
|
I should have also mentioned that when the image in panel1 (the app allows different sized images to be loaded) has a width which is less than the minimum width of the frame window, panel2 is filled with garbage.
Also, I do want to allow resize because the app has a status bar and other panels that are affected by resizing.
Regards,
-- Greg
|
|
|
|
|
Hi,
In my case..there is a server and client..
assume PC-A as server,PC-B as client.
Printer is physically connected to PC-A server,which is now can be called as Print Server(i.e,PC-A server).
The problem is as below..
Here the user is at PC-B(client machine),then he opens a normal word document(not through my application) and gives the normal file print...Then Immediately i have to invoke my .net windows application which is used for some accounting purpose.
To my knowledge I thought to write a service to watch/catch the spool file generation at client PC-B machine and then it should invoke the windows application..But actually the spool file is generated at Server end but at client end...
Kindly guide me to resolve this issue..
|
|
|
|
|
I have one chm file with full details. I linked this chm file with user defined function and it ill work and popup the chm file.But my problem is how can set help file with in which functionwizard is displayed the curresponding help.htm will show in the chm file
How can set in our application with html link
another problem is if i create setup for this how can i set the path for this chm file
Plz help me...
Thanks & Regards'
Tozy
|
|
|
|
|
Hello,
i'm developing a small C# application with VS2005,and i would like to let the user choose whether to immediately run the application at the end of the setup process or not,simply using a checkbox,similar to the typical ones who let the user display,for example,the "readme" file of a program.
Unfortunately,it seems i can't edit the last dialog of the setup process (the "Finish" dialog) nor i am able to move it up or delete it (in order to have as final dialog one with the checkboxes i want):i tried it but i got the error "Finish dialog must be the last dialog in the End group.".
Have you got any advice?
Thanks in advance!
|
|
|
|
|
Accius wrote: i can't edit the last dialog
Using what? If you are using Visual Studio or any other product you are limited to what it can do. If you want to take over development of your Windows Installer file you can use something like Orca[^]
led mike
|
|
|
|
|
Hi,
I'm trying to find a way to print a form containing Image at the top(logo), a caption under it, than a list and some remarks under the list. I cant use Office application such as Word, there is a way to print form with Graphics using PrintDocument component but how do i add the list?
I will be happy to get any help with it!
Thanks...
|
|
|
|
|
There are several articles here at codeproject that show how to print a form. A simple search should be able to find them.
|
|
|
|