|
I kind of started to post and then realised you could have handlers for controls within a form. So I was kind of talking to myself :P
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I tried making the mv class static and even moved the variables back to the form class setting them up as static as well. Neither of those ideas worked. What finally worked, though I don't know why, is to put
this.bitmapBox.Invalidate();
just before the exit of the paint event that fills the array and other variables. This caused a repaint of the second picturebox. The data was still around at that point and the bitmap was built correctly.
|
|
|
|
|
I wonder if there is a way to keep my application settings after version is changed (with AssemblyVersion).
.NET framework is creating separate folder to store .config file for each version of application, so user should enter all configuration in GUI once upgraded to newer version.
|
|
|
|
|
Take a look at the documentation for ApplicationSettingsBase.Upgrade . Make sure to follow all the links, there is a lot of information to assimilate. For individual settings the ApplicationSettingsBase.GetPreviousVersion method is useful.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have built a typed dataset which is Filled by SqlDataAdapter. The dataset has two tables (parent and child) with relationship using multiple columns (composite). The end objective is to replace this relationship with a dynamically generated one as some of the columns for both the parent and child table will be added at runtime and will be used as part of the relationship. The typed dataset has expressions defined, requiring me to have a relationship defined in advance.
The tests I have done ignores the dynamic columns and has fixed ones defined on the typed dataset that match the resultant query/recordset. The code replaces the existing relationship with an _exact_ copy using the same columns and relationship name as before (even having the parent/child relationship columns in the same order). The swap works fine but when I get to fill the dataset it throws the following exception:
<br />
System.ArgumentException: The row doesn't belong to the same DataSet as this relation.<br />
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos, Boolean fireEvent)<br />
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos)<br />
at System.Data.DataTable.AddRow(DataRow row, Int32 proposedID)<br />
at System.Data.DataTable.AddRow(DataRow row) .. blah blah blah<br />
The only difference I can tell between the old relationship and the new is their HashCode (obviously) and that the old relationship still has a reference to the parent and child tables (as MS likes bi-directional dependencies).
Puedo Code:
<br />
var dataSet = new MyDataSet();<br />
var parentTable = dataSet.Parent;<br />
var childTable = dataSet.Child;<br />
<br />
var relationshipName = "myrelationshipname";<br />
var oldRelationship = dataSet.Relations[relationshipName];<br />
<br />
dataSet.Relations.Remove(oldRelationship);<br />
<br />
var parentColumns = new List<DataColumn>();<br />
var childColumns = new List<DataColumn>();<br />
<br />
parentColumns.Add(parentTable.Columns["Column1"]);<br />
parentColumns.Add(parentTable.Columns["Column2"]);<br />
<br />
childColumns.Add(childTable.Columns["Column1"]);<br />
childColumns.Add(childTable.Columns["Column2"]);<br />
<br />
dataSet.Relations.Add(relationshipName, parentColumns.ToArray(), childColumns.ToArray(), false);<br />
<br />
this.FunctionToFillDataSet(dataSet, query);<br />
The above (real) code works fine if I don't remove / add the relationship.
The Original Relationship is setup for "Relation only" and not "constraints". When I add the new relationship, I use the overload to disable constraints ... DataSet.Relations.Add(relationshipName, parentcolumns[], childcolumns[], false) which I take as the same as "Relation only" from the first relationship.
I have searched all over trying to find someone with this problem. Most reference not adding the relationship which is clearly not the case here.
I'm on a strict schedule and having to go to my alternative will mean me having to drop the typed dataset all together and create my expressions and columns completely at runtime which I'd rather not do. We're a .net 2.0 environment. Development is under VS2008.
Any help would be greatly appreciated.
Thanks.
modified on Wednesday, August 26, 2009 8:44 PM
|
|
|
|
|
I am developing a C# Windows Application which inserts data into a SQLCE database.
It inserts fine, that works great!
However, if i want to select the new record from the database, it comes back as a blank result. I can search for previous records before i opened the applications. Its as though the database opens a cached copy, and you can only insert into it.
Here is my current code. Has anybody else had similar issues.
private void button2_Click(object sender, EventArgs e)
{
if (txtAddRegistration.Text != "")
{
if (comboAircraft.Text != "")
{
if (comboAirline.Text != "")
{
if (comboLocation.Text != "")
{
int picyesorno;
string picloc;
if (txtAddPicLoc.Text == "")
{
picyesorno = 0;
picloc = "";
}
else
{
picyesorno = 1;
picloc = txtAddPicLoc.Text;
}
string InsertRegCommand = "INSERT INTO SPOTTINGLOG (registration, aircraft, airline, location, date, pictured, picloc, comments) values('" + txtAddRegistration.Text + "','" + comboAircraft.Text + "','" + comboAirline.Text + "','" + comboLocation.Text + "'," + dateTimePicker1.Value.ToShortDateString() + "," + picyesorno + ",'" + picloc + "','" + txtAddComments.Text + "')";
string database = @"D:\Daniel\Documents\Visual Studio 2008\Projects\AviationSpottingLog\AviationSpottingLog\SpotData.sdf";
try
{
SqlCeConnection conn = new SqlCeConnection("Data Source=" + database);
conn.Open();
SqlCeCommand command = new SqlCeCommand();
command.Connection = conn;
command.CommandText = InsertRegCommand;
command.ExecuteNonQuery();
conn.Close();
}
catch
{
}
try
{
this.searchAfterAdd(txtAddRegistration.Text);
}
catch
{
MessageBox.Show("Search didnt work");
}
txtAddComments.Clear();
txtAddPicLoc.Clear();
txtAddRegistration.Clear();
comboAircraft.Text = "";
comboAirline.Text = "";
txtLabelAdded.Text = "Added";
AddStatus.Start();
}
else
{
MessageBox.Show("You must enter a location.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("You must enter an airline.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("You must enter an aircraft type.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("You must enter a registration.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void searchAfterAdd(string param)
{
this.spottingLogTableAdapter.Fill(this.spotSearchReg.SpottingLog, param);
}
private void btnSearch_Click(object sender, EventArgs e)
{
if (txtSearchReg.Text != "")
{
this.spottingLogTableAdapter.Fill(this.spotSearchReg.SpottingLog, txtSearchReg.Text);
}
else
{
MessageBox.Show("Please enter a registration to search for.\n\nIf you would like to view records for specific Airports, Airlines and Aircraft, go to 'Browse Data Lists' on the top menu.", "Enter Search Criteria", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
|
|
|
|
|
Hi All,
I created a simple application in C# that displays a message when a button is clicked. I want this app. to be updated from a network drive, the same network drive that it was published from using ClickOnce.
In the Publish --> Updates window of the apps properties, it's set up so updates are checked "before the application starts".
After a modification is made to the application and I re-publish it the updated files are sent out to the users machine along with an updated very of the setup.exe file.
However, when the user starts the application from the start menu they aren't informed that an update is available and the old version of the application is ran.
The start.exe file can be ran and the new version installed then, but this isn't what I want the user to have to do. Shouldn't the user be informaed of the updated version when the app is ran?
Any ideas would be greatly appreciated.
Thanks,
Mel
|
|
|
|
|
Don't cross post, you've already asked this question in another forum. Wait for someone to respond.
only two letters away from being an asset
|
|
|
|
|
Hello everyone,
I am having trouble with UdpClient class. Here is my code:
private UdpClient myClient;
private void button1_Click(object sender, EventArgs e)
{
myClient = new UdpClient(7777);
}
private void button2_Click(object sender, EventArgs e)
{
myClient.Close();
}
So when I press button1 to connect for the first time - Everything is OK
when I press button2 to discconect - Everything is OK
But when I try to connect for the second time by pressnig button1 I get the error : "Only one usage of each socket address (protocol/network address/port) is normally permitted"
How can I solve this problem? How can I bind my socket again? Any help will be appreciated.
Regards
|
|
|
|
|
The error comes only if you press button1 2 times.
If you press button1, button2, then button1 again, it's ok.
|
|
|
|
|
Why do you want to press button twice? When UdpClient 's constructor is executed with a port number, it binds to the port number provided. You can't rebind to that port again. Once the binding is done, call Connect() method to connect the socket.
|
|
|
|
|
We have a DataSet with Table Adapters built for MSAccess using OLEDB. We are using Visual Studio 2005 and .Net 2.0.
When the designer creates insert, update and delete queries it encloses the table name and field names with a ` (ASCII char 96).
For example:
INSERT INTO `table` (`col1`, `col2`, `col3`) values (...)
Is there a reason for this character? Assuming it's for escape purposes, is there a setting to make Visual Studio use another character, eg "[" or "]"?
If there is no setting, is there a way to intercept the way the designer creates these queries?
|
|
|
|
|
I am not sure how to remove it and character [ is valid for MS access. What issue are you facing with these characters?
|
|
|
|
|
We have to support SQL Server and MS Access as backend databases. Our app was originally written for MS Access using the VS designer. We are trying to have the same data layer (queries - basic insert, update, delete statements) work for both databases. After testing the queries, we found that if the ` char was removed, then the queries would work on both db's.
|
|
|
|
|
Hi , have a good day ...
I want to make My Own C# Messenger with C# ( Like , Yahoo , Microsoft , Google Talk ) ... but with less features ...
Here is what I am planning to do :
- Create C# Windows Application ( Clients ) All my customers will have it.
Included Me ...
- Connect from my computer to My customer computer and support them.
-------
But the problem is about the Web Site
I didn't have any clue where to start
What do I need , a Web Site ?
a Super Computer as Server ,
a protocol ?
P.S :
Customers Count is "300" or less
thank you so much for any word you say ?
I know nothing , I know nothing ...
|
|
|
|
|
Any computer can be a server. All you need is your messaging server running, and the required port(s) opened in your router/firewall.
Clients will need the WAN IP address (or domain name) of the computer acting as the server (could be hard coded) and the authority/knowledge of how to open the required port(s) on their systems.
The rest is a simple question of Client and Server code, which is reasonably trivial and there are a plethora of examples around.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
thank you so much , your replay give me a good view ...
I know nothing , I know nothing ...
|
|
|
|
|
I'd use TCP; for text, losing a part is generally seen as worse than suffering a slight delay
Just slap your own application level protocol on top
If you let all messages go through the server, you won't even have to worry about opening points on the client side. But you'd be putting more load on the server and the latency would be approximately doubled compared to peer-to-peer chat (where the server would only be used to look up the IP of a client from an ID/name/whatever)
Peer-to-peer is quite hard compared to server/client though.
|
|
|
|
|
Thank you , so much
But I think I can't make P2P because we need Real IP ,
yeah In my country , 70% of Internet Users have dynamic IP address ,
In Other Word , we all have the same IP Address
and I test that , On www.whatismyip.com
Thank you ...
I know nothing , I know nothing ...
|
|
|
|
|
If that means you're behind double NAT (national NAT and NAT at your router) then that is a big problem. Really bad.
Well just do client/server, that should be fine
|
|
|
|
|
you mean like this?
http://www.umbrasystems.com/gcomm.php
|
|
|
|
|
you mean like, advertizing?
|
|
|
|
|
- You basically need a server and client program.
- You can use TCP as a communication protocol.
- When designing server, you have got two choices. Either use WCF or work with raw TCP with sockets. I'd suggest to work with sockets directly rather than a WCF wrapper.
- The system on which server is running should open the port it is using.
- You need to create your own protocol for exchanging messages.
- Since the server has to handle 300+ connections, asynchronous programming style has to be used for more scalability.
Of course you also need a book. TCP/IP Sockets in C#: Practical Guide for Programmers[^] is a good book to start with.
|
|
|
|
|
Thank you so much ,,,
the idea is clear now ...
I will start programing with "TCP with sockets".
The book looks greate
kind regards,
I know nothing , I know nothing ...
|
|
|
|
|
I am writing an app that requires centralizing a number of Access App's data files into one SQL server. Albeit separate databases within it.
I know the Access Upsizing wizard can migrate access tables to SQL. As can the SQL server import wizard. However, I need to be able to schedule this and request it at any time from the server.
Getting the Access mdb files onto the server isn't a problem, that's all handled with WebServices. However, I can't for the life of me find a way to automate the table creation and data insertion for the sql server.
I have come across a number of resources listing how to pull data from a datatable object and create the database on the server using SMO (SQL Managemant Objects, i think) But I can't see any resources on how to actually pull the Access data into a Datatable object in the first place. Either way, this method obviously will incur some speed penalties, also maybe some problems with datatypes etc... So finding a way to automate the sql import is by far the better idea!
If anyone has any ideas I would be so grateful!
Thanks a lot.
Ben
|
|
|
|
|