|
sorry i didnt understand ,
in my textbox , i draw square using pen class at the top of textbox and later when i click to the textbox , cursor appear so square is damaged
how can i correct this
|
|
|
|
|
If you want a textbox without a cursor, you have to make it non-editable. That you do by disabling the textbox.
If you want to draw on top of a control, you have to do that in the paint event, or whatever you draw will be drawn over whenever the control is updated.
---
b { font-weight: normal; }
|
|
|
|
|
Hey again :P
So I have a XML with DataSet in it, in the DataSet I have 2 DataTables, in each DataTable I have a Uniqe ID, and I did to this row, auto-inc, and don't allow DBNull.
So when I try to do NewRow(), and add it without setting the ID column, it throws an Exception DataColumn 'ID' can't allow DBNull.
So how can I do it as UNIQE ID? do I need to allow DBNull?
|
|
|
|
|
Hi,
i am using tableadapters to insert into 2 different tables the insert methods are in transaction. The first insert must return a value for the second insert. both inserts works just fine if the execution mode of the first tableadapter is nonquery(it doesn't return the @@IDENTITY I need) and if i remove the neccessary forein key in the second table but when i change it to scalar(to get the @@IDENTITY neccessary) it returns the following error. "ExecuteScalar requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.". can anyone please help.
|
|
|
|
|
Hello.
I can't find a control to check a Regular Expression that I want... so I could check a TextBox.
How can I do it? (or what is the Control for that)
|
|
|
|
|
The control is the RegularExpressionValidator control.
---
b { font-weight: normal; }
|
|
|
|
|
I couldn't find it in the toolbox so I searched it in the "choose items".
When I did OK, it didn't show it in the toolbox, and then I did "Show all items", so it shows it, but I can't drag it or do something with it, it looks like it's disabled...
Maybe you know what can I do?
|
|
|
|
|
Just to make sure: Is it a web application you are working with?
---
b { font-weight: normal; }
|
|
|
|
|
No, it's a win application, that's why I'm posting here and not in ASP.NET forum.
but the other guy helped me.
|
|
|
|
|
That explains it. There is no built-in validation controls for windows forms.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hello,
I've got a table orders with 3 fields:
- date
- productid
- amount
productid & amount are values seperated by commas, f.e.: productid = 1,2 amount = 3,4 (which means there are 3 products "1" and 4 products "2").
Now, I want to select a field by date and get the value of productid & amount and put them in an array (or arraylist?).
Than, I want to fill a datagridview with again 2 colums (amount & productid) with that data.
So for the example the datagridview should look like:
3 1
4 2
This is what I wrote:
<br />
bill.Rows.Clear();<br />
SqlCommand myCommand = new SqlCommand("SELECT * FROM orders WHERE date = @date", connect);<br />
myCommand.Parameters.AddWithValue("@date", DateTime.Parse(listOrders.Text.ToString().Substring(0, 19)));<br />
SqlDataReader myReader = myCommand.ExecuteReader();<br />
while (myReader.Read())<br />
{<br />
amounts = myReader["amount"].ToString();<br />
products = myReader["productid"].ToString();<br />
}<br />
myReader.Close();<br />
<br />
string[] product = new string[products.Split(' ').Length];<br />
string[] amount = new string[amounts.Split(' ').Length];<br />
<br />
product = products.Split(' ');<br />
amount = amounts.Split(' ');<br />
<br />
for (int i = 0; i <= product.Length; i++)<br />
{<br />
bill.Rows.Add(amount[i], product[i], 1, 2);<br />
}<br />
But I always get an error near the product = products.Split ..
System.NullReferenceException was unhandled<br />
Message="Object reference not set to an instance of an object."
I don't really think the code is 100% ok, but can somebody help?
Thanks!
|
|
|
|
|
JelleM wrote: I don't really think the code is 100% ok, but can somebody help?
I've annotated your code with what it is doing.
bill.Rows.Clear();
SqlCommand myCommand = new SqlCommand("SELECT * FROM orders WHERE date = @date", connect);
myCommand.Parameters.AddWithValue("@date", DateTime.Parse(listOrders.Text.ToString().Substring(0, 19)));
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
amounts = myReader["amount"].ToString();
products = myReader["productid"].ToString();
}
myReader.Close();
string[] product = new string[products.Split(' ').Length];
string[] amount = new string[amounts.Split(' ').Length];
product = products.Split(' ');
amount = amounts.Split(' ');
for (int i = 0; i <= product.Length; i++)
{
bill.Rows.Add(amount[i], product[i], 1, 2);
}
Does this help you see what your code is doing?
"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
|
|
|
|
|
Yes, thank you!
|
|
|
|
|
I have problem with the data.
From my main window I click other form is opened and I want to type in some data like alarm time, but I have problem with display it in my main window.
I want display it in my label but i don't how to get to that label,and other variables in my main window from my second form??
-- modified at 9:55 Saturday 27th May, 2006
examle I have somethin like this
public partial class Form1 : Form
{
public int a, b, c;
public Form1()
{
InitializeComponent();
}
and I want to acces the a,b,c prameters from my form2.
|
|
|
|
|
Ok so what you would do is hand these variables to the constructor of your second form:
Ex.
public partial class Form2 : Form
{
public int d, e, f;
public Form2(int a, int b, int c)
{
d = a;
e = b;
f = c;
InitializeComponent();
}
...
public partial class Form1 : Form
{
public int a, b, c;
public Form1()
{
InitializeComponent();
}
something_OnClick()
{
Form2 frm2 = new Form2(a, b, c);
frm2.ShowDialog();
}
|
|
|
|
|
Maybe it's works, but I still don't know how to do this.
|
|
|
|
|
What dont you understand?
|
|
|
|
|
I don't know how it works.
Itried to do it as you wrote, but it doesn't work.
mariuszfryta
|
|
|
|
|
In my application I have one main window adn the second appears when I want to type in some data, then I click on the my bytton and I want to close that form.
How can I do it?.
I have tried the Application.Exit(); command but it close all windows.
Mariuszfryta
|
|
|
|
|
|
|
Instead of Application.Exit call the Close method of your Form inside the click event handler of your button.
Another way would be setting the DialogResult property of your button to something else than None. This way you don't even need the click event handler.
"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." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Which class do I use to change a file's line ending?
In Visual Studio, advanced save options, there is 'Line Endings' selection:Windows(CR LF), Macintosh.. and etc.
Can anyone please help me?
|
|
|
|
|
In what manner do you want to change the linebreaks in the file? Do you want to load the file and save it with a different type of linebreaks?
---
b { font-weight: normal; }
|
|
|
|