|
Thanks that worked great for me. I modified the installer class to show a form. This form will retrieve any information that I need!
|
|
|
|
|
hello,
My application depends on a sql server database I want to deploy my project in the client machine with out deploying the sql server express edition because it take some disk space and it some times cause some problems in its deployment(mainly if user don't have any experience).Is there any way to overcome this situation.
thanks
Dad
|
|
|
|
|
Hi
Right-click your project and add a new installer class. Within your installer class add following code
Public Overrides Sub Install(ByVal stateSaver As _
System.Collections.IDictionary)
MyBase.Install(stateSaver)
Try
' Creates the database.
ExecuteSql("master", "CREATE DATABASE dbTest")
' Creates the tables.
ExecuteSql(strDBName, "CREATE TABLE .....")
Catch ex As Exception
' Reports any errors and abort.
End Try
End Sub
I found this code in the net. Although it is written in vb.net it may help you.
Franz
|
|
|
|
|
thanks for help,
but does it will work on a client without installing any version of sql server.The main problem is that the user will use the database as a flat database like the access database.
is there a sql engine in framework 2 to attache the database to it.
thanks.
Dad
|
|
|
|
|
So basically what you are saying is you want a database on the client machine, but not install a full database environment, well sql compact is your friend
http://www.microsoft.com/sql/editions/compact/default.mspx[^]
one thing you cant do is have stored procs tho, but on the plus side its free
|
|
|
|
|
Hello,
most SMTP servers limit sending messages to 600 per hour, my application enables user to send
mail message to more than the limited number so I want to know how to get the count of messages sent in the current hour to inform user that there may be some messages will be send after an amount of time.
Dad
|
|
|
|
|
The SMTP protocol does not support a commmand to retrive the number of messages you can send per timeperiod. So I think you must set the limit and track it in your own application.
Espen
|
|
|
|
|
Is the query below performance-wise? If not, please tell how to optimize it.
return elements.SkipWhile(el => !startCondition)
.TakeWhile(el => !stop2condition)
.Reverse().TakeWhile(el => !stop1condition).Reverse();
The goal is to get a range marked as a ===== line:
---->start========stop1==========stop1------stop2----------
I have to find [start -> stop2] enumerator, and then cut the end. I cannot find stop1 directly, because between start and stop1 there are other elements which satisfy a stop1 condition. Other words, I need to get the last element which statisfies a condition stop1 before stop2. Hope it's clear what I meant here.
Any help appreciated.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
You van combine the boolean test. !stop1condition && !stop2condition
|
|
|
|
|
leppie wrote: You van combine the boolean test. !stop1condition && !stop2condition
!(stop1condition || stop2condition)
You have misunderstood me. I do not want to search for the first occurance of stop1 or stop2. I want to find a stop1 which is nearest to stop2 in a backward search. As I sad: the last stop1 before stop2.
Consider the following example:
-------start========stop1a=====stop1b-----stop2---
Your query would find start -> stop1a and I want get start -> stop1b .
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
My win forms application (c#) runs fine when its on a local path.
But, its not working when its located on a network / UNC path.
To make it work from a network path, I need help on the following :
1. Best way to determine if the current path is network path or not.
2. From the network path, I want to get the current user's TEMP directory path.
Neither Environment.GetEnvironmentVariable(Temp) nor Path.GetTempPath() worked from network path.
3. From the code/pgm running on network path, I want to run a batch file present in the user's TEMP directory.
Any guidance on this is appreciated.
|
|
|
|
|
Your problems is due to the .NET Frameworks default Runtime Security Policy. So if you need to run an .NET application from a network drive or UNC path, the best way is to configure the runtime policy in the .NET Framework Configuration utility (found under Control panel/Administrative tools).
Espen
|
|
|
|
|
It failed because of CAS in .net, you need to configure the permission of intranet as follows.
@%windir%\Microsoft.NET\Framework\v2.0.50727\caspol.exe -q -m -ag 1.2 -url file://FILEPATH FullTrust -n GROUPNAME
1.Best way to determine if the current path is network path or not:
You can use the regular expression.
2.From the network path, I want to get the current user's TEMP directory path.
What do you mean? the directory path of local machine or remote machine?
|
|
|
|
|
Thanks for the reply.
1. can the regular expression work even if network share is a mapped drive ?
2. I want to get the directory path of local machine.
Let the network drive be \\share1 & my code be \\share1\pgm1.exe.
When the user runs "\\share1\pgm1.exe", I want to retrieve his local machine's temp path which is similar to "C:\Documents and Settings\alias\LocalSettings\Temp". The local machine is a Win 2003 server. Once I get the local temp path, I wish to copy the files to this location from the remote share drive.
|
|
|
|
|
Dear All,
I've got a problem!!
If I want to rotate a PictureBox control/ or any winform control in any angle (lets say, after a certain time using a timer), what I am needed to do? I want to follow a process as simple as possible
thanks in advance
Faysal
|
|
|
|
|
Hi Faysal,
For rotating the PictureBox at 90 degrees, please use following code:
Me.PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipX)
To rotate images at any angle, refer to the below mentioned links:
http://www.codeproject.com/KB/cpp/rimage.aspx
http://www.codeguru.com/cpp/g-m/gdi/article.php/c3693/
http://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1743/
http://www.fastgraph.com/help/example_rotate.html
This[^]
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Vinay Srivastava wrote: Me.PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipX)
You are aware that this is the C# fourm?
"Listen, and listen well. I really like the band N-Sync. My favorite member is Harpo. I think there's a Harpo. If not there should be. I will write their next hit, maybe 'A boom-boom chiky chiky boom-boom a boom-boom chiky chaka chaka cho cho.' By the way, you must beware of Betty's iron claw. They are sharp, and they hurt. And beware his song about big butts, he beats people up while he plays it! " - Master Tang (from Kung Pow: Enter the Fist)
|
|
|
|
|
ive been working on a program that will tell you if a link is a Rick roll, and i am trying to load links in from an xml file to a listbox, but it skips the first lnik, i dont know why, here is the read xml code, and below it the xml file
public void ReadXmlLinks()
{
XmlReaderSettings xs = new XmlReaderSettings();
xs.IgnoreWhitespace = true;
XmlReader xin = XmlReader.Create(path, xs);
xin.ReadToDescendant("link");
while (xin.ReadToNextSibling("link"))
{
links_lb.Items.Add(xin["string"]);
xin.ReadStartElement("link");
}
xin.Close();
}
and here's the xml file im trying to read
<links>
<link string="http://www.youtube.com/watch?v=oHg5SJYRHA0">
</link>
<link string="http://www.youtube.com/watch?v=eBGIQ7ZuuiU">
</link>
<link string="http://www.youtube.com/watch?v=Yu_moia-oVI">
</link>
<link string="http://www.smouch.net/lol">
</link>
</links>
|
|
|
|
|
Try this method
public void ReadXmlLinks()
{
XmlReaderSettings xs = new XmlReaderSettings();
xs.IgnoreWhitespace = true;
XmlReader xin = XmlReader.Create(path, xs);
xin.MoveToContent();
while (xin.ReadToFollowing("link"))
{
links_lb.Items.Add(xin["string"]);
xin.ReadStartElement("link");
}
xin.Close();
}
|
|
|
|
|
Hi, to all
I am doing a task in which "main" thread spawns two new threads , 1 thread is worker thread whose task is to do all the processing and in another thread i am displaying window that displays progress with one "cancel button", So when a user clicks on the cancel button it asks for whether you want to terminate application thru a confirmation dialog box,up to this i have done but what i want when user clicks the cancel button the worker thread
should go in wait condition and if user doesn't want to close then it should continue from where it stopped .
any Idea, suggest me
|
|
|
|
|
One option would be to use Thread.Suspend(), but since it's deprecated it would better if you choose from Mutex, Monitor or Semaphore which are available in the System.Threading namespace.
|
|
|
|
|
I have been studying C# for about 4 or 5 months and then thought "Well I'll just write something from scratch. Well I felt like I've been reading a book on "How To Swim" and then when I jumped in the water I just gasped for air! Well anyway I hoping that someone could look at this and tell me how to use the return for the "public bool TrueOrFalse().
Thanks and sorry this is so elementary. I think I would like to write a book some day named a Beginner Beginner for the Basics of C#. Well any way here it is.
using System;
using System.Collections.Generic;
using System.Text;
namespace StartingOver
{
class RunIt
{
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
four*five
return answer;
}
public void Getyear()
{
Console.WriteLine("What year will you be beginning?");
string year = Console.ReadLine();
Console.Clear();
Console.WriteLine("Starting all over again in {0}\n", year);
}
static void Main(string[] args)
{
RunIt ri = new RunIt();
ri.Getyear();
ri.TrueOrFalse();
}
}
}
|
|
|
|
|
Hi,
Since the function is returning some value, you would need to extract the value to use it. ri.TrueOrFalse() has a value of Type Boolean. Therefore you would need a variable of Type Boolean to save the value ri.TrueOrFalse() is returning.
If you would like to see if ri.TrueOrFalse() is returning True or False, you may simply check it using If Else conditions.
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Right you are almost there!! lets just look at the function you are talking about
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
four*five
return answer;
}
It will always return false as it stands, because you are declaring answer but not setting it, then returning it. By default it will be set to false.
All you need to do is set it, so something like this (this is done freehand so may not compile)
public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer = false;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
if((four*five) == 20)
{
answer=true;
}
return answer;
}
Hope that helps and its what you wanted
|
|
|
|
|
Hello everyone
Ok I have a problem, I am working on a C# project that connects to my MySQL Database via odbc and I have it set up so I enter information password and username to connect to the database on the MainForm (the MainForm is set up for parent / MDI) once a connection has been established I will than select the table I want from the populated combobox, for example I would select contacts, once contacts has been selected it will open a new windows form within the parent form (MainForm).
Once that new MDIChild form is open I want to be able to access the open database connection from my main form, so I can enter information and save it to the database. I have pretty much everything done other than that.
sorry it if this does not make much sense i have been up sense 3AM going through MEPS for the Navy.
Thank you for your time.
|
|
|
|