|
Do you mean reusing the same code again and again?
You could write your own code snippet[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
when we create a block inside text editor, by pressing any key, that block disappears,
while existing block, if suddenly u press DEL key, content of that block get detroyed.
i dont want this, i want to have a block remain persist. pay attention i am talking only
about text editor not data manippulate or SQL server or....... just inside of text editor.
|
|
|
|
|
Write a Data Access Layer.
|
|
|
|
|
i'm trying to crate an AVI file using some screen shots as frames.but when starting the process it gives the the exception saying
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
the application that i use to create the avi file is loaded to my application using reflection.what i do is just pass the frames to this loaded application.
any idea why this occurs.
thanx n advance..
|
|
|
|
|
because you took a wrong turn somewhere.
Member 4257632 wrote: using reflection
why?
|
|
|
|
|
This is my code
Note newNote = new Note();
Search newSearch = new Search();
SRLS newSRLS = new SRLS();
Alarm newAlarm = new Alarm();
QuickLaunch newQuickLaunch = new QuickLaunch();
Calender newCalender = new Calender();
Time newformtime = new Time();
private void Form1_Load(object sender, EventArgs e)
{
notifyIcon1.Visible = true;
if (timeToolStripMenuItem.Checked == true)
{
newformtime.Show();
}
if (alarmToolStripMenuItem.Checked == true)
{
newAlarm.Show();
}
if (calenderToolStripMenuItem.Checked == true)
{
newCalender.Show();
}
if (sRLSToolStripMenuItem.Checked == true)
{
newSRLS.Show();
}
if (searchToolStripMenuItem.Checked == true)
{
newSearch.Show();
}
if (noteToolStripMenuItem.Checked == true)
{
newNote.Show();
}
if (quickLaunchToolStripMenuItem.Checked == true)
{
newQuickLaunch.Show();
}
timeToolStripMenuItem.Checked = Settings.Default.timecheck;
alarmToolStripMenuItem.Checked = Settings.Default.calendercheck;
calenderToolStripMenuItem.Checked = Settings.Default.alarmcheck;
sRLSToolStripMenuItem.Checked = Settings.Default.srlscheck;
searchToolStripMenuItem.Checked = Settings.Default.searchcheck;
noteToolStripMenuItem.Checked = Settings.Default.notecheck;
quickLaunchToolStripMenuItem.Checked = Settings.Default.quickLaunchcheck;
}
So id some one checks the box then closes the program and then reopens it the other form should be visible can anyone see the problem in my code? coz I can't
|
|
|
|
|
Are you saving the checked states of the checkboxes anywhere?
|
|
|
|
|
Yeh when They press the button they save the box if its checked or not and that works, but it just doesn't open when the form1 loads
|
|
|
|
|
Where is the state saved? In the configuration file?
|
|
|
|
|
private void timeToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["timecheck"] = timeToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void calenderToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["calendercheck"] = calenderToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void alarmToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["alarmcheck"] = alarmToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void sRLSToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["srlscheck"] = sRLSToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void searchToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["searchcheck"] = searchToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void noteToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["notecheck"] = noteToolStripMenuItem.Checked;
Settings.Default.Save();
}
private void quickLaunchToolStripMenuItem_Click(object sender, EventArgs e)
{
((ToolStripMenuItem)sender).Checked ^= false;
Settings.Default["quickLaunchcheck"] = quickLaunchToolStripMenuItem.Checked;
Settings.Default.Save();
}
|
|
|
|
|
So, on the form load, you should check the value of the setting and then check the appropriate check box and show the corresponding form.
You are checking the checked state of the checkboxes which will be unchecked by default on the form load.
|
|
|
|
|
Yay I fixed most of it!, but for some reason the code dose not work for the calender part
|
|
|
|
|
systemerror121 wrote: ((ToolStripMenuItem)sender).Checked ^= false;
And what is that supposed to do?
It's worse than that awful == true ..
|
|
|
|
|
alarmToolStripMenuItem.Checked = Settings.Default.calendercheck;
calenderToolStripMenuItem.Checked = Settings.Default.alarmcheck;
|
|
|
|
|
Copy - paste code is not confined to VB. The number of times I have done this is embarrassing, usually in TSQL where it is even more difficult to track down!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Copy - paste code is not confined to VB.
That doesn't makes VB any better. It still sucks.
|
|
|
|
|
Hello people!
I am getting a buffer (allocated with CoTaskMemAlloc) from an unmanaged DLL call along with the buffer's size. I would like to feed this buffer (or a copy of this buffer) to DataObject (and drag-drop it...). Is it possible and if yes, how?
I've been coding in C++ for many years now (so i am not new to the concept of the whole programming business), but i'm relatively new to C#, so please keep it simple for me.
Thanks in advance for any answers.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
The details depend on the kind of information you want to represent (string, image, simple binary, ...).
Think of it as a two-step prrocess: first make a managed object that actually holds your data (string, image, etc); then use this[^] DataObject constructor.
|
|
|
|
|
Thanks for the answer. The data is actually a shell item ID list, i supose i should add this as "pure" binary data, it can't be converted into a string (as far as i know), so basicly i guess my quesiton is: what do i "wrap" this into? This might be a basic question but as said, i don't yet have a well enough oversight with C#. I was looking at the *Ptr* methods in the Marshal class but i don't see which i could use, i tried reading the binary data byte-by-byte (Using Marshal.ReadByte) and add them to a list<byte> (yeah, it's a stupid idea but hell, i had to try), i could add this then to the data object with DataObject.SetData, but of course in the end i didn't get what i was looking for. Now i wonder if i could use one of the Copy methods to copy data from the unmanaged buffer to a managed byte[] array and then add that to the DataObject...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
What you're after is probably burried in here[^], it may be steep but I expect it is the best article on the subject and it has a code download.
|
|
|
|
|
Thanks, i'll try to dig into it, but it looks "scary" at first.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
If you feel new and uncomfortable about .NET and C#, maybe you should attempt something easier and less scary first?
|
|
|
|
|
I already did a few basic things to get aquainted with C#, it looks more friendly and welcoming as i originally expected it to be. I'm now experimenting with mixing managed and unmanaged code and drag and drop. What i did was to create a temporary jpeg image and try to drag-drop it. However, most of the time, the drag-drop of the image to applications results in no visible effect. I used ClipSpy to compare a dragdrop from the app and a dragdrop from the shell (expolorer), my guess is that most programs use the "Item IDList Array" in the data to open the dragged file, however, the dragged data from C# does not contain this. I googled around but didn't find anything satisfying, or i just googled for the wrong terms, so i wrote unmanaged code that generates the IDList array from a path into an array allocated with CoTaskMemAlloc and then i hit the problem of not knowing what to do with this buffer once i got it in C#. I might be trying to re-invent the wheel here but at least i am learning.
Am not yet sure if the article about writing a shell extension and avoiding the ItemIDList can help me or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
|
I want to make my forms in my software beautiful.I search but I realy dont know how to search. I find nothing. how could I make them beautiful?
|
|
|
|