|
I recommend that you put the remotable object into a "shared" assembly. Depending on what solution you need you can have either singleton, single-call, or client activated mode. The object is hosted on the sever. Whenever you call a method it is actually executed on the server.
Search around on MSDN for more information. Here's a good link for Microsoft QuickStart: samples.gotdotnet.com/quickstart/howto/doc/Remoting/nutshell.aspx[^]
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi
If the object is hosted on the server, then is the client get the object from the server and call methods on the client is the same as call the methods on the server?
If it is correct, can you give some examples.
Thanks!
|
|
|
|
|
Anyone know a good place to find a DLL/Project that I can import into my Solution that allows me to edit an ID3 tag in an MP3?
Currently out there the pickings are slim for anything that updates version 2 tags. I want something simple that I can reference like this:
using ID3Edit;
private void Get()
{
ID3Tag id3Tag = new ID3Tag();
id3Tag.GetV2andV1Tag("C:\\test.mp3");
txtTitleV2.Text = id3Tag.TitleV2;
txtTitleV1.Text = id3Tag.TitleV1;
}
private void Save()
{
id3Tag.TitleV2 = txtTitle.Text;
id3Tag.UpdateV2Tag("C:\\test.mp3");
}
I would be willing to pay $100 or so if someone could create a DLL like this for me within the next few days. I bet many other people out there are willing to pay for it as well. If you know of something that's already created in C# that is as easy to use as my above code, email me right away. I just don't have the time or knowledge to put something like that together.
Email me for details if you want the job or if you have a DLL like this:
Ethan
ethanwa@comcast.net
|
|
|
|
|
I will get you started and then let you finish up, this is really not a difficult task. If you read ID3 made easy[^], they explain the byte layout for the ID3 tag within a file. If you have further questions please feel free to post here. The following should get the ID3 tag out of your file:
class ID3Tag
{
public string title;
public string artist;
public string album;
public string year;
public string comment;
public string tracknumber;
public string genre;
}
private ID3Tag GetTag(string file)
{
string strTag = string.Empty;
ID3Tag tag = new ID3Tag();
ASCIIEncoding encoding = new ASCIIEncoding();
FileStream fs = new FileStream(file, FileMode.Open);
if(fs != null)
{
byte[] block = new byte[128];
fs.Seek(-128, SeekOrigin.End);
fs.Read(block, 0, 128);
fs.Close();
strTag = encoding.GetString(block);
if(strTag.Substring(0,3) == "TAG")
{
tag.title = strTag.Substring(3, 30);
tag.artist = strTag.Substring(33, 30);
tag.album = strTag.Substring(63, 30);
tag.year = strTag.Substring(93, 4);
tag.comment = strTag.Substring(97, 28);
if(strTag[125] == 0)
{
tag.tracknumber = strTag[126];
}
else
{
tag.tracknumber = 0;
}
tag.genre = strTag[127];
}
}
return tag;
}
HTH
- Nick Parker My Blog | My Articles
|
|
|
|
|
I didn`t have Data tab in my Toolbox. Why is this? Tried reinstall. Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
When I`m adding reference from COM, It shows error, " A reference to 'Microsoft ActiveX Data objects ............' could not be added. The type library wrapper tool 'tlbimp' connot be found on this system. Please re-install Visual Studio. "
i`ve already reinstall Visual studio, but it didn`t solve the problem. I then tried searching the tlbimp.exe, and found out it`s in C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin folder, and tried moving the file to windows system folder, and it didn`t change anything. Help please. I`m desperate. What should I do???
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
If nothing helps you can always use the tool to manually generate the wrapper. See MSDN[^] for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
I have a Panel object consist of many other objects such as labels, textboxes, checkboxes. Now I want to clone a copy of this Panel object. Does anybody know How to do it?
|
|
|
|
|
There is no built-in way of doing this. What you have to do is create a new instance and copy all the properties to the new instance. You can use reflections to do this.
Take a look at this: www.dotnet247.com/247reference/msgs/58/292067.aspx[^]
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
how would you remove and add child and root items to a tree view through code?
|
|
|
|
|
|
Hi,
I'm trying to close and dispose a form that is running in another process, but I get the error message "A first chance exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll", "Additional information: Cannot access a disposed object named "frmProgressWindow".".
Here's what I'm trying to do basically...
My main UI thread launches another thread in which I show a modal Progress Window (form with a progress bar). When I'm done performing certain actions, I want to close the progress window from my main thread, so I call this code:
Private Sub CloseProgressWindow()<br />
If _progressWindow Is Nothing Then Return<br />
_progressWindow.Invoke(New CloseProgressWindowDelegate(AddressOf _progressWindow.Close))<br />
_progressWindow.Invoke(New DisposeProgressWindowDelegate(AddressOf _progressWindow.Dispose))<br />
End Sub
The exception occurs on the "End Sub" (!) line. See the screenshot at http://www2.adonis.ca/disposeerror.png[^].
What am I doing wrong?
Thanks!
Carl
PS: I know the code is VB, and this is a C# forum, but I figured people in the VB forum wouldn't have enough knowledge for this question. Since I fully understand both languages, feel free to answer in C#
|
|
|
|
|
I figured it out!
For the record, I created a method in my Progress Window that close and dispose itself, and I call this method from my main thread. Works like a charm!
|
|
|
|
|
Hi Carl!
I created a method in my Progress Window that close and dispose itself, and I call this method from my main thread.
Sounds like the mistake I made when implementing my first Dispose() method. Although you're not supposed to access normal members after disposing an object calling Dispose() more than once should not throw an exception. If you haven't already done so I strongly recommend using the Dispose Pattern[^].
Best regards
Dennis
|
|
|
|
|
Hi all,
I want to get the absolute value of the pixel cordinates of an image using mouse position on the image. at present I can read the cordinates with respect to the active area of the image. But if the image is larer than the active window, we willbe havin scroll bars. for the remaining image, when we use the scroll bars, the remaining image will be shown in the actie area and when i read for the cordinates it is giving me relative tot he active area, which is not equal to the actual pixel cordinates of the image.
So, how can we read hte actual cordinates of the pixel cordinates on the image.
any ideas or suggestions,
|
|
|
|
|
If you are using a control based on ScrollableControl check the AutoScrollPosition .
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi all,
I am making a little application where I am using a datagrid.
A menu displays when the user right click on the datagrid.
This menu has insert, update, delete options. And when the user clicks on one option it opens a new form so the user can edit or insert data. After filling this form and submiting the data, the form closes and the datagrid should refresh.
MY question is:
Is it better to make a new query to the database to see the new Information in the datagrid or to insert manually the submitted data into the old Dataset?
Another question?
Is there any good component that offers Image in Datagrid?
Thanks.
|
|
|
|
|
Refreshing from the database is an extra round trip that is going to make your app run slower. If the only way of adding data to the database is through the form and you dont have any code updates the database based on what is attached to the DataGrid then its the way to go. Just make sure that you don't end up adding the same data twice.
Personally I don't use the DataGrid control that comes with .net. There are more powerful grids like Syncfusion's[^] grid.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Thanks a lot for the Sungfusion grid tipo
I think the best way is to add, update, delete the dataset and finally update the database with the updated dataset.
|
|
|
|
|
You can do it that way also. Depends on the way you do your business logic.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
I do some checking in the Validating event of a textbox. When I leave the form, I want to check the textboxes again to see if everything is correct. I have a recursive method that goes over all the controls on my form. Now I want to call the validating events for each control.
Is that possible? Is that good programming? And if not, how can I solve this?
|
|
|
|
|
This is not exactly good programming but you can try this code bit:
public class Tasks
{
public static void ForceControlValidation(Control c)
{
Type t = typeof(Control);
MethodInfo m = t.GetMethod("NotifyValidating", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic);
object obj = m.Invoke(c, new object[0]);
if (obj is bool && (bool)obj == false)
{
MethodInfo m2 = t.GetMethod("NotifyValidated", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic);
m2.Invoke(c, new object[0]);
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
I wrote an application that handles a few threads. (Thread Pool)
The application supports a Shutdown() method that calls to Thread.Abort() on all threads.
When I compile the application in VS .NET 2003 it works fine.
When I compile the same code in VS .NET 2005, the application deadlocks on the Thread.Abort() method.
As far as I know Thread.Abort() shouldn't lock the thread that called it.
Has anyone have the same problem ? or knows a way to solve this ?
Thanks,
Ami Bar
|
|
|
|
|
Hi Ami!
Ami Bar wrote:
As far as I know Thread.Abort() shouldn't lock the thread that called it.
It's not explictly said that Thread.Abort() is asynchronous however the online version of the VS 2005 documentation does state that "the thread is not guaranteed to abort immediately, or at all. This situation can occur if a thread does an unbounded amount of computation in the finally blocks that are called as part of the abort procedure, thereby indefinitely delaying the abort. To ensure a thread has aborted, invoke a Join method on the thread after calling Abort." (see Thread.Abort Method ()[^]) I guess that paragraph only makes sense if Thread.Abort() does not wait for the thread to terminate.
Ami Bar wrote:
When I compile the application in VS .NET 2003 it works fine.
When I compile the same code in VS .NET 2005, the application deadlocks on the Thread.Abort() method.
Keep in mind that both VS 2005 and the .NET Framework 2.0 are still beta versions. If it works fine with VS 2003 but not with 2005 you should enter a new bug report (if it hasn't been already reported) at the MSDN Product Feedback Center[^]
Best regards
Dennis
|
|
|
|
|
I'm running mySQL locally on my coimputer. When I run my C# application I have the connect as
string MySQLDBConnect = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;" +
"DATABASE=filetransfer;" +
"UID=********;" +
"PASSWORD=********;" +
"OPTION=3";
Everything works fine when it's set at localhost. But that's pretty useless as it onlly works on mmy PC. So instead I'll put in my IP adress. Let's say I change Localhost to 111.111.111.111. Then I get an error.
ERROR #0
Message: [MySQL][ODBC 3.51 Driver] Host '111.111.111.111' is not allowed to connect to this MySQL server.
Native: 1130
Source:
SQL: HY000
I assume this is a problem with my Mysql setup.
The database does get connected. I cna tell because I can see the connect going through my firewall. But I get a return error. I'm guessing it's with my database setup but I couldn't be sure.
|
|
|
|