|
You can set the command argument to get the value in itemcommand event.
BTW better you put this into asp.net forum there you will get more responses.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi Apurva.,
Thanks for ur suggestion.,
I couldn't get clear with ur answer .,
Anyway thanks for ur effort.,
I vl post this in a ASP.net Forum..
Prabu.T
|
|
|
|
|
I have a windows form that has a bindingnavigator that binds several bound textboxes, datepickers etc. Works great .
What I want to do is display the contents of a text file that is related to each record bound by the above. For example, if record 23 of 50 is currently in view then the contents of 23.txt are displayed in the textbox.
How do I go about that?
Thanks,
Glen Harvy
|
|
|
|
|
private void btnADD_Click(object sender, EventArgs e)
{
DataRow newRow = dataTable.NewRow();
DateTime login = this.timePicLogin.Value;
DateTime logout = this.timePicLogOut.Value;
TimeSpan ts = logout - login;
this.tbTotalLog.Text = ts.ToString();
newRow["LogIn"] = timePicLogin.Text;
newRow["LogOut"] = timePicLogOut.Text;
newRow["TotalLog"] = tbTotalLog.Text;
newRow["Activity"] = rtActivities.Text;
newRow["Date"] = DateTime.Today.ToShortDateString();
dataTable.Rows.Add(newRow);
ShowLB();
try
{
dataAdapter.Update(dataSet, "ActivityReport");
dataSet.AcceptChanges();
Application.DoEvents();
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message);
dataSet.RejectChanges();
}
FillLB();
}
private void FillLB()
{
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; User Id=; Password=; Data Source=C:\\Documents and Settings\\arnold\\My Documents\\db1.mdb";
string strCommand = "Select * from ActivityReport";
dataAdapter = new OleDbDataAdapter(strCommand, strConnection);
dataSet = new DataSet();
dataAdapter.Fill(dataSet, "ActivityReport");
OleDbCommandBuilder bldr = new OleDbCommandBuilder(dataAdapter);
dataAdapter.UpdateCommand = bldr.GetUpdateCommand();
dataAdapter.DeleteCommand = bldr.GetDeleteCommand();
dataAdapter.InsertCommand = bldr.GetInsertCommand();
dataTable = dataSet.Tables[0];
ShowLB();
}
private void ShowLB()
{
lbDate.Items.Clear();
foreach (DataRow dataRow in dataTable.Rows)
{
lbDate.Items.Add(dataRow["Date"]);
}
}
im catching an error: "syntax error INSERT INTO statement"
tnx.
|
|
|
|
|
It's probably stemming from the SELECT statement. It's bad practice to use a * to denote which fields you want from the table. Start be rewriting the SELECT statement to specify which fields you want, including the Primary Key.
SELECT keyfield, field1, field2, field3 FROM ActivityReport
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
is there a label control that can support bold or different color on the same line. by using tags like in HTML?
sample:
This is a test for bold and this for color
i want to implement this without using richtextbox
can anyone please help
-- modified at 5:34 Friday 11th August, 2006
|
|
|
|
|
As far as I know there is not such a control. You could, however, write this yourself fairly easily. One approach is to derive a class from Control. Your Text property would contain the text with any meta tags that you would define. In your OnPaint method you would render your text with colors, fonts, etc. based on any meta tags you may have.
I hope this helps.
-- modified at 22:48 Thursday 10th August, 2006
-- modified at 22:48 Thursday 10th August, 2006
Deus caritas est
|
|
|
|
|
thanks for replying Andy
as i am new to c# i dont have the idea how to do it or where to start
can you please point me to an article how to check for the tags and implement the rendering of text using the OnPaint method.
|
|
|
|
|
There are copious articles at CodeProject and on the web that explain how to draw custom controls in C#. Look at the Graphics class for drawing on a control's surface.
Deus caritas est
|
|
|
|
|
|
Hi I have a few questions to ask,
1. whats the difference between finalize() and dispose() method
2. why below code performs poorly and if i have to write a good code how the below code should be
static string Space (string s)
{
string s2 = "";
foreach (char c in s)
{
s2 += c;
s2 += " ";
}
return s2;
}
3. why following code fails,
int a = 5;
int b = 5;
object oa = a;
object ob = b;
Debug.Assert(oa == ob, "oa is not equal ob");
ans. is that because we cant assign == for an object.
4. The following code is being executed in a highly threaded environment.
1. Why does the Debug.Assert statement sometimes fail?
2. What can be done to stop this from occurring?
public class Warehouse
{
private int stockCount = 0;
public void DecrementStock ()
{
if ( stockCount > 0 )
stockCount--;
Debug.Assert ( stockCount >= 0 )
}
public void IncrementStock()
{
stockCount ++;
}
}
thanks in advance.
|
|
|
|
|
oh I could pass this test! (Wait, I did ACE this test)
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I am not doing a test you moron. just want to know thats all.
|
|
|
|
|
uglyeyes wrote: you moron
Yeah, that'll get your questions answered...
BTW, your post DOES look like a take-home test, or at the very least, a homework assignment. I think you'll have to do your own work for this one...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Yeah, that'll get your questions answered...
uglyeyes should heed my sig...
I'd like to help but I don't feel like Googling it for you.
|
|
|
|
|
The difference between genius and idiot is public preception. I am often critisized by the dumb masses so I will take the better of the two.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi
Has anyone made a tab control transparent?
Basically what I'm trying to do is only draw the tabs and not the background for the tab control. Is it possible?
Thanks
Limey
|
|
|
|
|
I have created a File Watcher program. This has on event which is raised when a file is added to a folder. I want to receive a message or a hint that file transer to that folder is complete. I get the message at the begging of the file transfer that is when file starts droping to that folder. How can I achieve that at the end of file transfer I get the message ?
I am trying to use follwoing eventhandler, but it does not tell me when File trnasfer is complete.
private void FileAdded(object source, Utils.FileWatcherEventArgs e)
{
try
{
string path = "c:\\Temp\\xyz.txt";
if (File.Exists(path))
{
using (StreamReader sr = new StreamReader(path))
{
sr.BaseStream.Seek(0, SeekOrigin.End
if(sr.Peek()!= -1)
{
MessageBox.Show("File Transfer Complete");
}
}
}
}
catch(Exception ex)
{
Console.WriteLine("The process failed: {0}", ex.ToString());
}
}
In life, failures teach you as much as — or perhaps more than — successes.
Thank you very much for the help.
Bharat.
|
|
|
|
|
There's no such event. The accepted method is to keep trying to open the file with exclusive access, denying Shared Read and Write access to the file. If you can open it, chances are the file is done being written to, but NOT in all cases! It depends on the process that's writing the file. If you can't open it, wait a little while and try again.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I was able to print the document using PrintDocument.
I was trying to preview the document using the PrintPreviewControl.
I was display one page using PrintPreviewControl.
Is there a way to display multiple pages using PrintPreviewControl
if so how
Thanks
kal
|
|
|
|
|
hello. I have downloaded sample code from microsoft, and under the Project Properties --> Additional Dependencies, they have "$MSSdk"\Include. I know that "$MSSdk" is a variable, but I'm not sure where/how to define it as the path to the Microsoft SDK I have installed. My question is, how would I do so?
I love to program!
|
|
|
|
|
If you install the platform SDK, this should take care of itself. Perhaps even the SDK that comes with the IDE maps to this. Why do you think there's a problem ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The samples provided with the SDK won't compile. I ran the program that the ReleaseNotes.Htm file said to run and it said the environment variables were set, but the samples still won't compile. If I keep them in the same directory I don't have write access, and if I move them to another directory, it can't find anything.
I love to program!
|
|
|
|
|
allenmpcx wrote: The samples provided with the SDK won't compile.
What happens ? What errors do you get ?
allenmpcx wrote: If I keep them in the same directory I don't have write access
Then change the file properties so you do.
You could also replace the settings with absolute paths if you wanted to
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks a lot! I got it to work with msbuild *project_name.sln* and it worked. Thanks a lot again.
I love to program!
|
|
|
|