|
You don't stop the ProgressBar on an event. That's just relying on a house of cards.
If you need the ProgressBar stopped, explicitly do it from the code that determines if it should be stopped.
|
|
|
|
|
Member 10579673 wrote: i want to add a progress bar that must start on button1 click and stop on textbo color change event. I vote for "no", with this argumentation:
A progressbar is like a way of showing the user how the computer counts to 10, or wait until something is 100% - it shows progress. It does not start on a click and end with a random event; there's hardly any progess you can report in between. How would you know when to set the progressbar to, say, 50%?
I can show a progressbar if I know how much things I have to do; say I modify 50 records, I set the max to 50 and update the progressbar every second. That's progress.
Waiting until "something happens" is different; if you show a progressbar, set the max to, say, 100, and increment every second - your bar will overflow after 101 seconds. It's common to show an animation at that stage. We use animations, because they prove that the application is still responding. Sometimes that's all you can do, tell the user you're still alive and awaiting an event.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi All, I have a billing form as displayed below.I want to show products. I can use a combo box instead of product textbox. but since I have 100000 record of products, combo box is not a good option. Instead, As the cursor enter the product text box, I want to display another form with textbox and datagrid view exactly in the place of product text box.(it looks like a combobox for the user). The user can then search and select a record from the form and the selected value is returned to the product text box, after closing the search form. Iam having the below issue
1. Iam not able to correctly position the search form in place of product text box. can anyone help please. below is the code
Private Sub TextBox1_Enter(sender As Object, e As EventArgs) Handles TextBox1.Enter
frml.Location = New Point((Me.Location.X - TextBox1.Location.X), (Me.Location.Y - TextBox1.Location.Y))
frml.Location = New Point((My.Computer.Screen.Bounds.Height - Me.Height), (My.Computer.Screen.Bounds.Width - Me.Width))
frml.Show()
frml.Visible = True
End Sub
How to display a search and select form in place of a text box in c# or VB.net. The search form should look like a dropdown box to the user
|
|
|
|
|
You could do this with just a TextBox and a DataGridView . As the details are added to the TextBox you select a set of records from the database and use them to populate the DataGridView .
|
|
|
|
|
Hello in my Windows forms application wich show database records, I have a button to save new records but new records are stay only in obviously between form and database, and dont save to a database. Here is a code. I using a Dataset, and Dataadapter
Thanks a lot !
I have this from http://www.homeandlearn.co.uk/csharp/csharp_s12p9.html[^]
private void btnSave_Click(object sender, EventArgs e)
{
DataRow row = ds.Tables[0].NewRow();
row[1] = txtFirstName.Text;
row[2] = txtSurname.Text;
row[3] = txtJobTitle.Text;
row[4] = txtDepartment.Text;
ds.Tables[0].Rows.Add(row);
try
{
objConnect.UpdateDatabase(ds);
MaxRows = MaxRows + 1;
inc = MaxRows - 1;
MessageBox.Show("Database updated");
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
btnCancel.Enabled = false;
btnSave.Enabled = false;
btnAddNew.Enabled = true;
}
|
|
|
|
|
Where is the code for your UpdateDatabase method?
|
|
|
|
|
There is code for UpdateDatabase
public void UpdateDatabase(System.Data.DataSet ds)
{
System.Data.SqlClient.SqlCommandBuilder cb = new System.Data.SqlClient.SqlCommandBuilder(da_1);
cb.DataAdapter.Update(ds.Tables[0]);
}
|
|
|
|
|
Are you sure that the DataAdapter is correctly linked to the DataSet ?
|
|
|
|
|
I think that Dataset is correctly connected to a Dataadapter , because in form I see data from database. What would happen when a Dataadapter is incorrectly connected to a DataSet ?
|
|
|
|
|
If they are not properly linked then the updates will most likely fail, although I would expect to see an exception in such a case. It is difficult to be certain what the issue is, although you may like to try contacting the person who provided the sample code.
|
|
|
|
|
Put a breakpoint on
cb.DataAdapter.Update(ds.Tables[0]);
then select "ds.Tables[0]" and right-click. Choose quick watch. In here you can drill down on the object. Check if the change you made is there. if not, my guess is that you'll need to set some property in the designer or when creating the Dataset/DataAdapter in code.
Hope this helps.
|
|
|
|
|
From the last paragraph of said tutorial;
(If the new record doesn't appear when you restart, go back to Design Time. In the Solution Explorer, click on your Database under Resources to select it. Now have a look at the Properties window below the Solution Explorer. Locate a property called Copy to Output Directory. It has three settings: Do not copy, Copy always, and Copy if newer. If your database is not updating, try either Copy if newer or Copy always.)
I did not see any update-statements, nor an implementation of "objConnect.UpdateDatabase(ds)". I suggest you look for a different tutorial. For one, I think that databinding is better explained on MSDN[^], second because databinding hides a lot of the (boring) details.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
I have large panel which contains numbers of controls, I want to export that panel and all the controls to the PDF by using iTextSharp. Plz help
|
|
|
|
|
Member 9852108 wrote: Plz help Please provide proper details of your problem, and exactly what help you need.
|
|
|
|
|
NEED HELP!!
My project is 'digital steganography' in which we are doing image, audio and video steganography. We taken help from CodeProject, image is working properly but in audio steganography im stucking somewhere...
here is the code snippet:
WaveStream.cs
private void CopyHeader(Stream destinationStream)
{
BinaryReader reader = new BinaryReader(m_Stream);
BinaryWriter writer = new BinaryWriter(destinationStream);
if (CopyChunk(reader, writer) != "RIFF")
throw new Exception("Invalid file format");
writer.Write( reader.ReadInt32() ); // File length minus first 8 bytes of RIFF description
if (CopyChunk(reader, writer) != "WAVE")
throw new Exception("Invalid file format");
if (CopyChunk(reader, writer) != "fmt ")
throw new Exception("Invalid file format");
int len = reader.ReadInt32();
if (len < 16){ // bad format chunk length
throw new Exception("Invalid file format");
}else{
writer.Write(len);
}
m_Format = new WaveFormat(22050, 16, 2); // initialize to any format
m_Format.wFormatTag = reader.ReadInt16();
m_Format.nChannels = reader.ReadInt16();
m_Format.nSamplesPerSec = reader.ReadInt32();
m_Format.nAvgBytesPerSec = reader.ReadInt32();
m_Format.nBlockAlign = reader.ReadInt16();
m_Format.wBitsPerSample = reader.ReadInt16();
//copy format information
writer.Write( m_Format.wFormatTag );
writer.Write( m_Format.nChannels );
writer.Write( m_Format.nSamplesPerSec );
writer.Write( m_Format.nAvgBytesPerSec );
writer.Write( m_Format.nBlockAlign );
writer.Write( m_Format.wBitsPerSample );
// advance in the stream to skip the wave format block
len -= 16; // minimum format size
writer.Write( reader.ReadBytes(len) );
len = 0;
/*while (len > 0)
{
reader.ReadByte();
len--;
}*/
// assume the data chunk is aligned
while(m_Stream.Position < m_Stream.Length && CopyChunk(reader, writer) != "data")
;
if (m_Stream.Position >= m_Stream.Length)
throw new Exception("Invalid file format");
m_Length = reader.ReadInt32();
writer.Write( m_Length );
m_DataPos = m_Stream.Position;
Position = 0;
}
_______________________________________________________
in above snippet im getting exception thrown from here:
if (m_Stream.Position >= m_Stream.Length)
throw new Exception("Invalid file format");
im doing it for .wav file, please help.
Krrish8891
|
|
|
|
|
Has it occurred to you that when you drop out of the while loop above that line then m_Stream.Position will be equal to the length of the stream ... it's why you drop out of the loop
|
|
|
|
|
hi i want to know , how i can get each page total rows . using itextsharp dll .
i want to put all of my code onStartPage
public class MyPdfPageEventHelpPageNo : iTextSharp.text.pdf.PdfPageEventHelper
{
public override void OnStartPage(PdfWriter writer, Document document)
{
}
}
ty for any help
|
|
|
|
|
Is it a PDF you are reading, or one that you are creating, that you want the page count for?
If you are reading a PDF you could get gate the page into a string(this example will extract page 1).
string page = PdfTextExtractor.GetTextFromPage(new PdfReader(fileName), 1,new SimpleTextExtractionStrategy());
Then count the new line characters in the string.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 2-May-14 8:11am.
|
|
|
|
|
No , the pdf that im creating.
|
|
|
|
|
In which case I guess you have answered your own question.
If you are creating it yourself you will be inserting lines, therefore you will know how many lines you have inserted into the PDF.
Or to put it another way - if you are creating the PDF why is it that you don't know how many lines are in the PDF?
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
i know how many lines it'll write on pdf file but bcz of the different height between lines i can't figure out how many line first page can contain , and how many other lines second page can contain .
let's say i have 200 line with different height , how should i know how many page it takes . it sure that it depends on the line height .
|
|
|
|
|
There are a number of ways to do this – what I did, as I knew that I had the same font size on the page , was to print 100 lines at that font size to see how many pages that took.
If you are using different font sizes then this will probably not work for you – at which point I would suggest google.
What I would look for is to see if anyone has a formula for calculating the line height – there will be a number of considerations such as DPI that may need to be taken into account.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hi,
we are developing an mobile application and we have used WCF service to fetch SQL Server data through online.
We are trying to authenticate each WCF Service call(server) by passing headers from client (mobile application). For this we have generated a token and passed the same in headers of each client call.
We have stored the tokens in HttpRuntime.Cache. But after few minutes [in idle mode] the cache entry is cleared.
Note: If continuously server and client communicates, it works perfectly.
Below is our WCF service Cache code:
HttpRuntime.Cache.Insert(key, Token, null, DateTime.Now.AddHours(1),Cache.NoSlidingExpiration);
if some other better solution available, kindly suggest how we can save the tokens alone in server and authenticate the same from client for each service call.
|
|
|
|
|