Friday, July 31, 2009

Bullets in a Textbox for every EnterKey Press

-------------------------------------------------------------------------------------
I have a multiline textbox and I want to have a bullet show before the first line typed in the tetbox and a bullet submitted for everytime the user hits enter.

I got somewhat of a bullet to appear when the user hits enter and but it appeared after the text not before. This is what I got:

SOL:-
private void pad2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
pad2.AppendText("-");
}
}

SOL:-

You can use:

pad2.Text = "-" + pad2.Text;

This will prepend your character before your text string.


SOL:-
Try using • or [alt]+0149 to get an actual bullet. That is as ascii key code for a bullet!
--------------------------------------------------------------------------------------

Reading Excel, Date Value become Null orBlank

SOL1:-

sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strValue + ";Extended Properties=\"Excel 8.0;HDR=NO\"";

cn.ConnectionString = sConnectionString;

cn.Open();

string sSQL = "SELECT * FROM [Sheet1$]";
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = sSQL;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(excelList);
dataGridView1.DataSource = excelList;

---------------------------------------------------------------------------------
Hi everyone,
I have the above code to call a excel, but when the field is a date and the vaue is also a date, there is nothing to show in my datagridview... it is not showing the 5 digit date value either.....
-------------------------------------------------------------------------------------

SOL2:-
Please set the datasource of datagridview to a table as bellow:
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];

If the problem still arise , Please try to download the application to see if it works:
http://cid-219dc49fbdfffbd1.skydrive.live.com/self.aspx/Public/WindowsFormsApplication5.rar

Reading Excel, Date Value become Null orBlank

sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strValue + ";Extended Properties=\"Excel 8.0;HDR=NO\"";

cn.ConnectionString = sConnectionString;

cn.Open();

string sSQL = "SELECT * FROM [Sheet1$]";
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = sSQL;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(excelList);
dataGridView1.DataSource = excelList;

---------------------------------------------------------------------------------
Hi everyone,
I have the above code to call a excel, but when the field is a date and the vaue is also a date, there is nothing to show in my datagridview... it is not showing the 5 digit date value either.....

How Can i write code for "Form1.cs" window is Deactive(close) when a form "Form2.cs" is loaded

(C#)- I have call'ed a Form "Form2.cs" from another form "Form1.cs", using form1's.show(); . When form2 is Actived [Shown] then automatically form1 should be close, but not form2. How can i write code for : when a form2 is activated, then form1 should be de-activate(nothing but close the window). Plz help soon...

Ans:.

Messagebox Should appear after the Main Form (page)is loaded[appear], How?

(C#): Actually, i have application with in that application, i wrote a "welcome message with Time" in the FormLoad event [application], That'swhy , When i run the application, first loading the messagebox, by clicking ok btn only the main form is loading.

Plz tell me the process, How to write steps to load mainform first in that messagebox should appear?

Followers