|
or use the "text" - type ( make sure to read about the limitations / gains - but I guess if the text is more than 4000 characters this type is the way to go - you don't want an index on this field right ? )
|
|
|
|
|
Hello!
Is there any way to work with i.e. read and write data more than 8000 characters?
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
yes this is exactly what the text type is for (if you are using unicode take the ntext)
|
|
|
|
|
Hi, I want to disable a keypress handler of a mdi container form. I'm adding this on the container's Form_load:
this.KeyPress += new KeyPressEventHandler(Form1_KeyPressed);
and this on the child's VisibleChange event:
if (this.Visible)
{
principal.KeyPress -= new KeyPressEventHandler(principal.Form1_KeyPressed);
}
else
{
principal.KeyPress += new KeyPressEventHandler(principal.Form1_KeyPressed);
}
where principal is a property assigned on the child's load, in order to call the objects on the parent form:
principal = (FormMain)this.MdiParent;
When i run this the first time works. The handler works until I turn visible the child form for the first time (which tells me the -= is working), removing the parent's handler. After i visible=false the child, the handler gets added back, but now it calls 2 times the event attached instead of 1, and so on with every on/off of the child (3, 4, 5)...
why?
thanks a lot for your time.
daniel
|
|
|
|
|
Ok: the problem is with the if (this.Visible) , because this will be Form1 if the child is - well - a child of Form1 and you are handling the VisibleChanged event there.
Just replace this with child.Visible or (Control)sender (I am assuming you didn't change the event-param-names for the second one.
May I ask: why doing it this way?
Just put
if (child.Visible == true) return; to the From1_KeyPressed - handler.
|
|
|
|
|
wow, faster than i could edit it. I accidentaly posted it before finishing it out.
No, i'm not handling the visiblechange on form1 (parent), just on the child.
this.visible actually refers to the child.
i had to do it this way because the child form has a "searcher" textbox to a "SELECT blabla like" query on the textchange to a database.
|
|
|
|
|
Hi.
i'm not sure if you have to do it that way, but if i have to unsubscribe eventhandlers i use to keep them as member variables in my class:
public MyForm:Form
{
private KeyPressEventHandler myHandler;
public MyForm()
{
InitializeComponent();
myHandler = new KeyPressEventHandler(Form1_KeyPressed);
subscribe();
}
public void subscribe()
{
this.KeyPress += myHandler;
}
public void unsubscribe()
{
this.KeyPress -= myHandler;
}
private void Form1_KeyPressed(object sender, KeyPressEventArgs e)
{
}
}
and from your MDI Child form you do simply call now the subscribe() and unsubscribe() methods.
hope this helps
m@u
|
|
|
|
|
nope, didn't help, i keep getting the same problem....
i have to do it this way, if i try to go with the return way on the handler, the textbox that i want to work on doesn't get the typed text...
|
|
|
|
|
Hi,
I have the code following
private void btnSelectTable_Click(object sender, EventArgs e)
{
foreach(string str in listTables.SelectedItem)
{
listSelectedTables.Items.Add(str);
}
}
I have 2 checkedlists named "listTables","listSelectedTables"
I want to remove one item from "listTables" and place it in "listSlectedTables" ,when user clicks on the button "btnSelectTable".
Regards,
chanzeb chaudhary
|
|
|
|
|
I guess you've got a problem with something like
listTables.Items.Remove(str)
inside your foreach -block right?
Well that's because you are trying to change the collection your are enumerating ...
whenever I need something like this I use something like
<br />
Stack<string> toDel = new Stack<string>();<br />
foreach (string str in listTables.SelectedItem)<br />
{<br />
listSelectedTables.Items.Add(str);<br />
toDel.Push(str);<br />
}<br />
while (toDel.Count > 0)<br />
listTables.Items.Remove(toDel.Pop());<br />
</string></string>
|
|
|
|
|
"Error 1 foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'"
this is the error in the line where "foreach" is written....
I dont know what is the problem....
Regards,
chanzeb chaudhary
|
|
|
|
|
ah - sorry you are using ".SelectedItem" <- this will be just the one object you selected (that is a string),
try using ".SelectedItems"
|
|
|
|
|
Thanks Alot
Regards,
cganzeb chaudhary
|
|
|
|
|
Thanks Alot
Regards,
chanzeb chaudhary
|
|
|
|
|
How can I convert byte[] to string. Plsz help me soon
Thanks all.
Papais
|
|
|
|
|
dungpapai wrote: Plsz help me soon
Sure, here[^] you go.
Cheers,
Vikram
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
Hello,
I am kind of new with regular expressions. As far as I search over the internet I couldn't find a resonable solution. Suppose I have the following in a string:
Word0 word1 word2 word3 word4 word5 word6 word7 word8 word9
How can I capture the following?
word4 word5 word6 word7
I would like to catch the text between TWO boundries word4 and word7.
I`ve tried a lot of things none of them works.
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
Hi!
Something similar to
.*(word4.*word7).* should work.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have a Bitmap reference "wavImg" inside of my custom UserControl. A method in this control, call it method "A" does the following:
wavImg = new Bitmap(x,y);
Graphics g = Graphics.FromImage(wavImage);
... drawing here
g.Dispose();
The OnPaint() method is overridden in the control and it checks if wavImg is null and if it's not, wavImg is drawn on the control.
Method A ends up being called by a GUI event handler, so it executes in the GUI thread. Likewise, OnPaint() is called from the GUI thread. The issue is that after "A" executes, the paint event happens, and OnPaint() is called, wavImg becomes null. The ONLY time wavImg is set to anything is in method A, the one assignment statement. Dispose() is NEVER called on wavImg.
How is it possible that wavImg becomes null?? There is exactly one reference to it in the class, so it shouldn't have been garbage collected. Any ideas are appreciated!
Thanks!
|
|
|
|
|
Hello,
maybe you should post more of your code.
I can't see the problem from here - only thing I can guess is that maybe you mistook
if (wavImg == null) with if (wavImg = null) ? (Not likely - I think there is even a warning for this kind of mistake).
Is the wavImg a static variable in the class? Try finding all references to wavImg, get a breakpoint to this line and try doing it the hard way (checking every step through the debuger).
By the way: the GC don't set ANY object-reference to null - it's looking for all objects in memory that aren't referenced at all at the moment and deletes them from memory! So if you've got an reference in code (reachable - i.e. not local variable or someting, the GC must find it from the root) the GC will do nothing at all to this object. And the GC will wait a long time before kicking in (that can be a pain if you forget some Dispose()
|
|
|
|
|
In the following example 1 I added rows to the DataSet
And I did not have any problem. However when I tried to add rows to a DataSet with more than one dimension I get the following error message at row 1 “Object reference not set to an instance of an object.”. I am unable to add the word new after equal sign. Does anyone know how to solve this problem.
Example 1
DataRow dr = dsI.EVar.NewRow();
dr["nRecordID"] = x;
dsI.EVar.Rows.Add(dr);
Example 2
DataRow dr = dsMI[x][1].EVar.NewRow();
dr["nRecordID"] = x;
dsMI[x][1].EVar.Rows.Add(dr);
Thanks in advance,
Michael
|
|
|
|
|
What is dsMI? Is it a DataSet[][] ? If yes, did you actually create an object for dsMI[x][1]? Creating a DataSet[][] does NOT create a 2-D array of DataSet objects, it only creates a 2-D array of *references* to DataSet objects, all of which are, by default, null .
Cheers,
Vikram
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
dsMI is a DataSet and I did create the DataSet using
DataSet_MI[][] dsMI = new DataSet_MI[10][1].
Everything was done exactly as with dsI and it loaded dsI.
Michael
|
|
|
|
|
Vikram was right - looks like you don't initialise the object referenc - additionally you have a problem with dsMI[x][1] - you should get an ArgumentOutOfRange exception here! Watch out for the '1'.
Try using one more line:
dsMI[x][0] = new DataSet_MI();
just before the add.
|
|
|
|
|
Did you read my post? DataSet_MI[][] dsMI = new DataSet_MI[10][1] only creates a 2-D array of references, *all* of which are null , not a 2-D array of DataSet s. You have to do
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 5; j++)
{
dsMI[i][j] = new DataSet();
}
} to get a 2-D array of DataSet s. Replace 10 and 5 with your dimensions.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|