|
I am trying to input \n\n in my query while running an INSERT query, but MS Access if not allowing me to do so, at the same time it doesn't allow me to pass single quote into the query.
Any body know how to resolve it and how to deal with this kind of situation.
The Phantom.
|
|
|
|
|
Hi,
I have five textboxes, where each of them defined as txtControl1 to txtControl5.
Now I am running a loop to populate these textboxes with some text like this
for (i=1; i<6; i++)
{
txtControl+i.Text = "Hello World" ;
}
Now when I am compiling, I am getting error "unable to find txtControl", with error message its clear the above line is unable to contact the control with the value of i.
Is anyone know how to do that
The Phantom.
|
|
|
|
|
This kind of loop can only be made if you store your textboxes previously in an ArrayList or normal array:
private TextBox[] myTextBoxes;
myTextBoxes = new TextBox[] { txtControl1, txtControl2, txtControl3, txtControl4, txtControl5, txtControl6 };
for (i=1; i<6; i++)
{
myTextBoxes[i].Text = "Hello World" ;
}
|
|
|
|
|
You will not be able to convert i (which is int variable) to first a string variable, and then a string variable to a textbox.
Better way to do so is to declare an ArrayList (say called arrayTextBoxes).
Then, initialize this ArrayList in the constructor of the form on which the textboxes are placed. You can declare the initial capacity of this ArrayList (which defaults to 16).
Thereafter, (in the constructor of the form itself) populate the ArrayList with the instances of the 5 textboxes being used by you, by using the Add or AddRange method.
Now you are ready to use the members (i.e., the textboxes)of the ArrayList in your code as, for example,-
for (i=0; i<5; i++)
{
//here the arrayList is 0-based, so use i = 0 onwards
((TextBox) arrayTextBoxes[i]).Text = "Hello World" ;
//arrayTextBoxes is the aforesaid ArrayList instance
}
In the aforesaid example, arrayTextBoxes[0] will represent the textbox1, and so on.
|
|
|
|
|
How can I know the installed SAPI version (4.0, 5.0, 5.1) on my compouter?
egyseiko
egyseiko
|
|
|
|
|
I need to make a two dimension array in my C# program, if I use ArrayList it would take ages to just assign a simple value to each cell. If I use System.Array the disk would run out of memory and the computer might hang. The size of array I'm using is about 10000 X 10000. What do I do?
Thank you
|
|
|
|
|
This greatly depends on what you want to do with this array.
In one of my projects (where I also had several large 2 dimensional arrays) I write those directly to disk. Because I write the files byte by byte by myself I can randomly access the matrix directly in the file (by using the FileStream.Position property). With some intelligent caching mechanism you can even make this being fast .
More general you should be think about what really needs to be in your array. Are you storing double or decimals? Probably floats or integers are sufficient.
For more detailed hints you would have to describe what kind of data you are having in your arrays and what you want to do with it.
|
|
|
|
|
Hi!
I'm looking for a way to maintain the scrolling ability of a listView during
a drag&drop operation (necessary if the screen is too small to display all
the items of the lv), pretty much like the Windows Explorer does it - when
you hit the upper edge of the window it scrolls upwards.
By the way the AutoScroll property of my ListView is set to true.
Thanks already in advance!
|
|
|
|
|
I declared private variables
DataSet ds=new DataSet();
SqlConnection cn=new SqlConnection();
and i load one table from sql server set to datagrid datasource.and memory usage is increasing and i call dispose method to deallocate object.but memory usage is still remaining.
i dispose like that..cn.dispose(),ds.dispose().
how can i fix it?
|
|
|
|
|
Although those objects are disposed correctly this doesnt mean that the garbage collector immediatly frees the memory. This is only done "when needed". You could try calling GC.Collect() , but this is considered a bad practice.
|
|
|
|
|
If in the main thread, I have a form with edit box, and call a thread. How do set the edit box value from the othere thread. Thank you.
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
Have a look at the Control.Invoke method. This will ensure the call will be made in the correct thread.
|
|
|
|
|
Hi,
I've got a RichTextBox, and I'm wondering if there is a way to "scroll" thru the display area without actually using the built-in scrollbars e.g. have the scrollbars disabled, and then using buttons to scroll thru the display area.
Please help
|
|
|
|
|
Not directly but there is a little trick:
Find out the position where you want to scroll to and call richTextBox1.Select(index, 0) . This will set the carret to this position. Then call richTextBox1.Select() . This will cause the scrolling because the RichTextBox always scrolls to the carret position when it gets selected.
To scroll through the full text the following could be done:
for (int i = 0; i < richTextBox1.Text.Length; i++)
{
richTextBox1.Select(i, 0);
richTextBox1.Select();
}
|
|
|
|
|
|
Hello, I`ve got a problem with opening excel woorbook using this code.
I`ve got office xp 2002 with sp3.
On one computer i dont have this problem, but on the other one appears exception.
object mis = System.Reflection.Missing.Value;
Excel.Application excel = new Excel.ApplicationClass();
Excel._Workbook wkb = excel.Workbooks.Add(mis);
Excel._Worksheet sht = (Excel._Worksheet)wkb.Sheets[1];
I did add reference to excel 10. TypeLib version 1.4
This is the exception i`ve receive.
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SqlToExcel.exe
Additional information: Old libary or incorect form.
(Biblioteka w starym formacie lub nieprawidłowy typ biblioteki).
I dont now what to change in the code.
Please, help meeee.
|
|
|
|
|
hi the re i'm wondering if any one cud tell me of an alternative for using system.xml.xpath & system.xml.xsl in the .NET CF (using C#.NET) as some of u might know both name spaces are not supported in the CF?!!
i'm trying to use this in smart device application:
XslTransform xslt = new XslTransform();
xslt.Load(stylesheet);
XPathDocument xpathdocument = new
XPathDocument(filename);
XmlTextWriter writer = new XmlTextWriter("result.html", null);
writer.Formatting=Formatting.Indented;
//
xslt.Transform(xpathdocument,null,writer);
regards
|
|
|
|
|
Hi!
I got the following problem:
I invoke from a dll a class which contains an array. I modify the array, but i can't set it back with the SetValue Function.
Here some code:
// Add an object to the array
object[] cNewArray = (object []) System.Array.CreateInstance(m_cCurrentObject.GetType(),cTmp.Length+1);
// Copy old values
cTmp.CopyTo(cNewArray,0);
// Set new value
cNewArray[cNewArray.Length-1]=cXmlSerializer.Deserialize(cReader);
// initial generated object, write the values back, m_cCurrentObject is a reference to the array member in the object obtained with the GetValue Function, Throws an System.ArgumentException. The SetValue Function accepts only object not object arrays.
m_cGenObject.GetType().GetField("identity_template").SetValue(m_cCurrentObject, oValue);
Thanks for your help.
53746F6E65
INT 19H
|
|
|
|
|
any ideas how we can retrieve REG_EXPAND_SZ value from registry? ex. when i insert it as %windir% and retrieve it it automatically expands it, how can i stop it from autoexpanding? i want the actual value not the expanded one.
|
|
|
|
|
How make validatin that whitespace are not allowed in textbox?
How i get the key code of press key?
|
|
|
|
|
There are two different things you can do:
1. Handle Validating event for the TextBox , and use regular expressions to validate that no spaces are in the string the user entered, and if yes, don't allow the user to go to another control before correcting it.
2. In the KeyDown event, if the key is a space, set e.Handled = true , so the TextBox doesn't handle it, effectively eating the keystroke.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
i tried using this but it does not work
i tried using this sample code.
private void textBox1_KeyDown(object sender,System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyValue==65)
{
e.Handled=true;
}
}
it still prints the character 'a' in the text box
|
|
|
|
|
tyutyutryryr
ghfgh
fghfghf
ghfgh
fgh
f
gh
fg
hf
gh
f
h
gfh
|
|
|
|
|
Hi...
I have an RichTextBox, and i want to make the textcolor/backgroundcolor diffrent from the other text, but it is not all the text wich should be diffrent... only some of it!
I have tried this...
int WordID = 5;
richTextBoxText.Select(0, WordID);
richTextBoxText.SelectionColor = System.Drawing.Color.Blue;
richTextBoxText.Select(0,0);
but if the richtextbox has scrollbars, it will go top of the text, and i do not want it to do that!
can anyone help me how to change the color, so it would not select the first char. but instead that char it was before the color changed!
Thanks
QzRz
|
|
|
|
|
Have you tried remembering the old location?
int oldIndex = richTextBoxText.SelectionStart;
int WordID = 5;
richTextBoxText.Select(0, WordID);
richTextBoxText.SelectionColor = System.Drawing.Color.Blue;
richTextBoxText.Select(oldIndex, 0);
|
|
|
|