|
Thanks for the help but not a good suggestion. Often times we have no connection but that does not mean we can not work.
I will pull the data and store them in xml files and once connection is available the app will synchronize with central db.
I have the stored procedures and you are right about that.
Thanks
|
|
|
|
|
Hello,
I am new to .net n working with Framework 3.5
Currently working on Application developed in Borland Delphi.
We have 2 exe's named as DBPro.exe and Data.exe
I am rewriting Data.exe which deal with Data Interaction with SQL Server.
Now the project work like, We have button in DBPro.exe which Opens up Data.exe n while doing this it Passes the Message to it using Post Message. I dont have code for DBPro.exe
After All work wen we close Data.Exe it is suppose to PostBack message to Calling Exe i.e. DBPro.exe which will reinitialize it.
I found line PostMessage(HWND_BROADCAST, dbmesg, 0, 0); in Data.exe, in the Form End section which is suppose to Post Back the Message. Now I want to do the same with my new Data.exe. So far I found I can use some invoke method but have no idea how to use it.
I'll appriciate any pointers on this issue.
Thanks.
Some declarations look like this..
PostMessage(HWND_BROADCAST, dbmesg, 0, 0);
strpcopy(mstr, 'WM_DBMESG');
dbmesg:=RegisterWindowMessage (mstr);
I am not able to found any declaration for HWND_BROADCAST
Niks
|
|
|
|
|
I posted the Problem.. n found the answer for it.. M calling PostMessage on Button Click!!
private void btnClose_Click(object sender, EventArgs e)
{
const int dbmesg=49706;
const int HWND_BROADCAST=65535;
Win32.PostMessage(HWND_BROADCAST,dbmesg, 0, 0);
this.Close();
}
public class Win32
{
[DllImport("user32", EntryPoint = "PostMessage")]
public static extern int PostMessage(int hwnd, int wMsg, int wParam, int lParam);
}
This will Close the Data.Exe and Broadcast Message. I Defined the same constant I found in Old code, even when I dont really know what they really mean..
But this code is working for me..
To Import Win32.dll need to add using System.Runtime.InteropServices; namespace!!
Guys.. any one know how exactly this work.. to give more understanding..!!
Thanks
Niks
|
|
|
|
|
I am designing a sci-fi game and need to create a "map" of the galaxy (a 8x8 grid) that contains space objects (stars, planets, spaceships, etc) some of these objects contain no more than a name property, but some like the spaceships are more complex having methods as well as properties.
What I am confused about is that a collection holds a list of a-like objects, so it could hold a list of planets or stars but not both.
So, how can I create a Galaxy collection containing all the different types of space objects?
I am not looking for code just some advice on how to implement.
Thanks,
Lee.
|
|
|
|
|
The most elegant solution is to create an interface, like IGalaxyObject, and make all you classes implementing it.
It could look like the following:
public interface IGalaxyObject
{
void DrawYourselfOnTheGrid(Rectangle coords);
}
public class Star : IGalaxyObject
{
public void DrawYourselfOnTheGrid(Rectangle coords)
{
}
}
ICollection<IGalaxyObject> galObjsColl = GetCollection();
foreach (IGalaxyObject galObj in galObjsColl)
{
galObj.DrawYourselfOnTheGrid(someCoords);
}
|
|
|
|
|
Sounds suspiciously like the Summer Code Competition[^]. Just remember, if you receive any help from CP (articles or forum posts):You must specify any resources (code, concepts, research etc.) used in creating your article that were not originally produced by you.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
I was thinking of doing something for this - but having a black hole at the centre of the galaxy and using gravity sling shots to gain higher warp speeds... but then I realized how sad I was!
Dave
|
|
|
|
|
Scott,
It is indeed the Summer Code Competition. I am not actually sure if I will submit it to the competition, I am just using the idea to practice my coding and learn c#. If i was to submit it I would of course aknowledge any help I received, as we all should .
Lee.
|
|
|
|
|
Are you sure a typical galaxy fits in an 8x8 grid?
|
|
|
|
|
sure why not, anything is possible
actually in each of the squares there is another 8x8 grid, thus we have 4096 squares. which is big enough for my purposes.
Lee.
|
|
|
|
|
I can export the database part numbers into an array. I want to be able to search that array with predictive search. a good example is www.yahoo.com's search engine text box on the front page.
How do i achieve this within a windows form and not in a web project. I've searched around for this but have not found much of anything useful.
Thank you guys!
Patrick!
|
|
|
|
|
What have you been able to do so far?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Have you tried using the Custom AutoComplete function of the textbox?
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
|
I don't know if this is the proper way to do it but I usually do it this way.
1. Create a Datatable
2. Fill the Datatable with the column of interest (Select COLUMN from Table)
3. Use a foreach loop to go thru each row
4. Use a StringBuilder to append those rows
5. Attatch the StringBuilder to the textbox.
I usually doesn't any encounter a very long initialization time using this method. I used it in one of my OPAC projects.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
|
Hi,
Two comments:
1. I suggest you have a look at String.StartsWith()
2. You might want to store the results of cachedPartNumbers[i].ToString() rather than calling
it all the time
|
|
|
|
|
Hi,
My code is looping through records and adding items to a listbox as below:
forloop
{
lstBox1.items.add("item1");
lstBox1.items.add("item2");
}
Question:
How can I change the colour of SOME of the items as they are being added?
Thanks
|
|
|
|
|
Hi,
there are two basic features you need:
- ListBoxes can contain items of any type, not just strings
- you can paint those items yourself (DrawMode OwnerDrawn, event DrawItem)
So the neat way to do this is define a little class (say MyItem) and let it hold a string and
some style field (maybe a Color). Add instances of that class to the ListBox, make it OwnerDrawn,
and provide a DrawItem handler according to your wishes.
As a shortcut, when I only need two variations (say black and red), I skip the MyItem stuff and
prefix the red items with a special character (say '~'), then in DrawItem check the first char,
and if a '~', choose Color.Red and drop the '~'.
|
|
|
|
|
Hi,
I am not a good c# developer so not sure how to do what you suggested.
Can you make it simpler or guide me through it further please?
Thanks
|
|
|
|
|
Sorry, no spoon feeding here. I gave you all the required keywords, let Google and MSDN provide you
with the details; and CodeProject holds thousands of interesting articles too.
PS: don't switch Controls, if ListBox is your first choice, stick with it. It is a very good performer.
|
|
|
|
|
|
Luc Pattyn wrote: Sorry, no spoon feeding here.
He may not get what he wants (maybe mashed peas, squash, etc)
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
For a start, the loop is incorrect. It'd probably be something like this
for(int i = 0; i<3; i++)
{
lstBox1.Items.Add("item" + i.ToString("N0"));
}
Also, the standard ListBox cannot do that on its own. You could paint it yourself if you have a good grasp of the Graphics object, or you could use the ListView. The loop would change to something like this
for(int i = 0; i<3; i++)
{
ListViewItem lvi = new ListViewItem("item" + i.ToString("N0"));
lvi.BackColor = Color.White;
ListView1.Items.Add(lvi);
}
|
|
|
|
|
Hi,
I am trying to use a listview to make this easier.
Do you know why I do not get Color in the intellisense please?
Thanks
|
|
|
|