|
I guess I'm not sure what your question is. You can fix this problem by including the full path to the MDB in the connection string. Or are you just making the comment that the OLEDB driver is not a relative path ? If you want to make sure the path to the MDB is the same as the EXE you can use the static property of Application.StartupPath...i.e.
string MDBPath=Path.Combine(Application.StartupPath,"MyFile.mdb");
String ConnStr=string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=False",MDBPath);
|
|
|
|
|
You just got bit by your assumption that the current directory will be the directory that your app was launched from. This is almost always never the case.
NEVER assume that the file you want is in the current directory. ALWAYS supply a full path specification to whatever function you need.
In your case, I'm assuming that the database you want is in the same folder as your application .EXE:
string appPath = Application.StartupPath();
string filePathToDatabase = Path.Combine( appPath, "myFile.mdb" );
string connStr = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", filePathToDatabase);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
heres the deal. i have an image loaded into a bitmap. i have another bitmap with two colours. its like a map, i read all the black pixels and make a region out of it. now i want to stick the first bitmap into the cutout bitmap. however i want the first bitmap to be "squished" into the second, giving like a warped effect if the map is designed correctly.
this is the link to the website showing the image and the map to use.
www.users.bigpond.net.au/livebox/index.htm[^]
its a simple concept but for the life of me i cannot think of a way to do it. i thought about getting each pixel from the original and placing it inside the map but then the bitmap might not be the same size thus i have to strecth it. that and the fact that the map can be anything and my program has to skew the bitmap regardless of its shape.
thanks for your time and help in this
stumped
goran sterjov
|
|
|
|
|
Nice idea
Basically, consider the following: Do you have a single region or can there be multiple regions? If there can be multiple regions, you need to find a way to divide your image into smaller ones. Do that as you see fit
The second part: You now have an image and a corresponding "region" in which you need to "squish" your image.
Now, this is where it comes to experimenting. You need to find some algorithm which you can use to "map" image coordinates to region coordinates. if they both are of the same shape and aspect ration, you could simply "divide" the coordinated from the image (using PointF) by the resize ration (or something like this) and then draw them into your region.
Well, you want to do other regions as well, so I suggest you imagine the following situation:
You have your image, laid out in wooden cubes (pixels). You now want to push this image into a certain shape. So, you start on the outside and push the first "pixel". Doing that affects other pixels, which also change position. as you probably will not push hard enough to compress the wood, it will give way by "jumping" up, so that pixels lay over each other.
Now, if you look from above, the "image" has been pushed into shape at the expense of dozens of "pixels" overlapping each other and obstructing view. You could compensate by mixing the colors of all overlapping "pixels", but I suggest you simply remove all obstructed "pixels".
I am quite sorry that I cannot translate the following sentence, but I simply have no idea of how to say this in English:
"Die Richtung, in die du deine "Pixel" schiebst, entspricht einer Linie von der Aussenkante dieser Region zum Mittelpunkt. Stauche anhand dieser Linien, wie oben beschrieben." <- German
Cheers
Sid
|
|
|
|
|
thanks, i see what you mean and will experiment more with these nasty pixels. only hope i hit the solution soon else i will go crazy.
thanks again
goran
|
|
|
|
|
I write a asp.net program and need to know which user is now logged in clients . for example if user "A" is logged button B must enabled And if User "B" is logged button B must disabled in my webform .
Can anyone help me ?
Regards' Amir jalaly
|
|
|
|
|
Each Page has got a User attached to it, so you might want to go writing something like in your Page_Load Eventhandler:
if(User.Identity.IsAuthenticated && User.Identity.Name == "Pete") {
Button1.Enabled = true;
}
What authentication model are you using?
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
I am new to C# and Visual Studio.
I have created a basic application which has resulted in a .exe executable. I want to send this so that it can be reviewed by other people. The people reviewing it will not have Visual Studio and propably not even the .net framework.
How do I distribute this so that they have all the libraries and framework to allow them to run this. I will be wanting to release this in a regular bais so I don't want it to be too formal. I also want it to be very simple as it will be sent to non technical people.
Just to let you know that there is no web based content in this project - in case that makes any difference. It is all Windows Forms running on a local machine.
Thanks,
Liam
|
|
|
|
|
You can try creating a Installer project using Visual Studio. That'll result in a nice setup file that will also install the .NET framework if it is not available.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Creating an Installer is alright, but will it not mean a huge size distributable file because the Installer (bootstrapper) will add about 1MB to 2MB size, whereas .NET framework installation facility may add another about 15MB to 20MB (as the .NET framework size is that much)?
So, a small assembly of say 30 KB will become a distributable file of several MB.
But, the question is will there really be so much addition to the size?
|
|
|
|
|
hi all,
I know that How to register a event..
suppose that ,I want to register Load Event..Then we can do it like this:
this.Load += new System.EventHandler(this.Report_sessions_Load);
But How Do I unregister a Event using C#?
Thanks in advance..
|
|
|
|
|
yeah I hear this stuff isnt in the docs at all, and certainly isnt intuative
this.Load -= new System.EventHandler(this.Report_sessions_Load);
|
|
|
|
|
|
There seems to be alot that you require on users machine to run a C# dll addin. You must install .Net framework, Office PIA's and then your own C# dll. Complicated for a user to do. Is there any simplified way around this complication, using install shield for instance. Also my project requires the extensibility.dll which does not come with .Net framework it appears. Do I have to include this in my C# dll setup project.
Cheers
Mit Semaj
notsnoj
|
|
|
|
|
Hi allllllllll
How can I create report in HTML fromat in C#
Thanks
|
|
|
|
|
<br />
Response.Write("< html >< body >");<br />
Response.Write("report");<br />
Response.Write("< /body >< /html >");<br />
Jeff Martin
My Blog
|
|
|
|
|
I have Form1 and call a thread. How to set the value of an edit box in Form1 from the thread(class DownloadThread). Thanks.
public class Form1 : System.Windows.Forms.Form
{
private void btnGO_Click(object sender, System.EventArgs e)
{
DownloadThread dwThread=new DownloadThread(str,1);
Thread thread=new Thread(new ThreadStart(dwThread.GetStream));
thread.Start();
}
}
public class DownloadThread
{
public void GetStream(string str,int dLevel)
{
}
public void GetStream()
{
}
}
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
Pass an instance of the edit box to your download thread class. Also keep in mind you cannot modify a Windows Forms control like and edit box from a thread other than the GUI thread. Use Control.Invoke or Control.BeginInvoke to marshal a call back to the original thread.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Hello, i'm using a dataGrid in my application to load in data from an access database. The data is loading in fine and all, i'm just looking for a means of having each column resize automatically to fit it all in on the screen. For example i have a details column that when normally viewed you can't see all the details until double clicking the column divider at the top to resize it to fit the data.
I'm just after a means of getting it to automatically resize rather than having the user need to double click the column divider to have it resize.
Thanks In Advance,
Bryce.
|
|
|
|
|
Only Microsoft knows why this little feature was ommited from the 1.0 and 1.1 Framework DatGrids, but here[^] is an aritcle on MSDN that demonstrates how to do it. It's in VB.NET, so it shouldn't be too hard to convert the code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I am trying to run an .exe application using RunAs. I don't know how can RunAs handle the exception of the exe application I want to run.
Can you guys give me a hint?
Thanks so much.
|
|
|
|
|
|
Could you please be more detailed?
Where should i search?
Thanks
|
|
|
|
|
Hi,
I am developing a C# application, that has display the list of classes, methods and properties from a .jar file and .class file (created in java). How to accomplish this?
Thanks and Regards.
|
|
|
|
|
AFAIR, Jars are compressed archives in a standard format (ZIP, I think), which contain a manifest.
You should be able to use most open archiving libraries (but check on the format first).
Cheers
Sid
|
|
|
|