|
Mark Nischalke wrote: handle the button lick event
But I don't know where that button's been!!
|
|
|
|
|
Mark Nischalke wrote: First, no one is going to follow this link to look at your image.
Why not? I appreciate when people post links to images to help convey their question more clearly. Now, when they post links to zip files and such that contain code, that's an entirely different matter.
|
|
|
|
|
It's called a slide menu. It isn't used that much any more, mostly replaced by the ribbon control.
|
|
|
|
|
I have a Windows application in Visual Studio 2008. This application has data which I want to store in a database. I went into SQL Server Management Studio 2008 and created data tables which I want to access from Visual Studio.
I have clicked on Project, Add new item, Linq to SQL. I have a window open that's labelled DataClasses1.dbml. I clicked on Data and add new data source. In that tab I clicked on Add New Data Source. I clicked on Database and next. I clicked on New Connection and have a window open "Add Connection". I don't know what to do here. Can anybody help me?
Thanks.
Darrall
|
|
|
|
|
Choose the ConnectionType (OleDb, SQL, SQLCompact....)
Then choose the server or type it (if express edition then defult it is
something like .\SQLEXPRESS), then choose the DB, Test the Connection clikc
OK or Add foollowed by some Next(s).
Then in order to use LINQ to SQL you need to "add new file" to your project,
choose LINQ to SQL DBML follow and follow the setps.
NOTE: IN Visual Studio Express(C# lets say) you can't do it.
At least not in the 2008 version. You add the DBML. You need to manually
create the DataContext/Mapping.
But a much better source will be Gingle.
Search for videos of LINQ to SQL.
|
|
|
|
|
Thanks for your answer. What I still need to know is what to put under Database:
I created a database called ConstructionSurveyLayout in Management Studio but when I Browse my computer I can't find it. What am I supposed to put in that textbox?
|
|
|
|
|
normally the DBs on a local/personal computer not Server/Network should be in a folder like:
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA
|
|
|
|
|
Ok. Thanks
|
|
|
|
|
Hello,
I'm attempting to have a console program take a path as an argument.
I have the following code executing:
static void Main(string[] args)
{
HandleArgs(args);
}
public static void HandleArgs(string[] args)
{
foreach (string arg in args)
{
if (arg.Contains("/path:"))
{
string execpath = arg.Substring(6, arg.Length - 6);
}
}
}
What i'd like to do is to take the string[] args as it is passed to Main() as a verbatim string.
The problem arises when the argument /path: is input as /path:"c:\documents and settings\" . The string arg in args is not verbatim, and execpath is then c:\documents and settings\" not c:\documents and settings\ as desired.
Another foreseeable situation is the the /path: argument is /path:""c:\documents and settings\" , as I am attempting a condition to determine if the last character is a \
How can I take the string into string[] args passed to Main() as a a verbatim string.
Thanks,
Matt
|
|
|
|
|
I'm not sure what you're asking; the term "verbatim string" makes no sense in this context.
If you want the command line as it appears on the command line, and not split into a string array, then try System.Environment.CommandLine
P.S. If you mean that you are looking at the string in the debugger and seeing \" rather than " -- please remember that the \ is not really there, it's only displayed for your convenience -- write it to the console and see for yourself.
modified on Thursday, April 1, 2010 12:54 PM
|
|
|
|
|
The following are the command line arguments:
/path:"c:\Documents and Settings\mbrown\Desktop\securable.exe" /save:"c:\Documents and Settings\mbrown\Desktop\"
The following code:
try
{
Console.WriteLine(savepath + "~scrublbdy.tmp");
streamer = File.CreateText(savepath + "~scrublbdy.tmp");
streamer.WriteLine("All work and no play makes Jack a null toy.");
streamer.Close();
File.Delete(savepath + "~scrublbdy.tmp");
}
catch (Exception err)
{
Console.WriteLine(err);
Environment.Exit(1);
}
Produces the following error:
C:\Documents and Settings\mbrown\My Documents\Visual Studio 2008\Projects\securable_buddy\Securable_Buddy\Securable_Budd
y\bin\Release\Securable_Buddy.exe /path:"c:\Documents and Settings\mbrown\Desktop\securable.exe" /save:"c:\Documents and Settings\"
c:\Documents and Settings"\~scrublbdy.tmp
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileO
ptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.CreateText(String path)
at Securable_Buddy.Program.HandleArgs(String[] args) in C:\Documents and Settings\mbrown\My Documents\Visual Studio 2
008\Projects\securable_buddy\Securable_Buddy\Securable_Buddy\Program.cs:line 117
Note c:\Documents and Settings"\~scrublbdy.tmp .
The trailing \ is being treated as an escape character in the argument. So the "best" solution I can think of is making the arguments that are passed to the main() function be verbatim strings.
Any idea how to modify the incoming args to the Main() function static void Main(string[] args) to make them literal?
Thanks,
Matt
|
|
|
|
|
bbranded wrote: Any idea how to modify the incoming args to the Main() function static void Main(string[] args) to make them literal?
You cannot modify them. The .NET command line parser doesn't have any options.
The only solution I see is the same as PIEBALDconsult suggested: take Environment.CommandLine and parse it yourself.
|
|
|
|
|
|
Or maybe you need a simple Trim ?
|
|
|
|
|
Ok so I have a parent form called frmMain and a child panel called panelMasterlist.
In panelMasterList I have created a delete event(right click context button) on the frmMain there is a Delete button as well
I need to trigger the same event from the frmMain as in the panelMasterlist.
In panelMasterList the clcik event is: public void contextDeleteMasterList_Click(object sender, EventArgs e)
so I was thinking in the frmMain I can send a event argument to the namespace.class? Not sure how to do this
|
|
|
|
|
To fire event you can use the MenuItem.PerformClick method.
To call it from the form you should expose a public method in the PanelMasterlist class that fire the delete event, something like this:
public void DeleteMasterList()
{
contextDeleteMasterList.PerformClick();
}
|
|
|
|
|
Create a method that handles the action and call it from both the main form menu item and the panel context menu item
private void Delete()
{
}
protected void OnDeleteMenu(object sender, EventArg e)
{
Delete();
}
protected void OnDeleteContextMenu(object sender, EventArg e)
{
Delete();
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi forum
I have this inconvenience
I have an application with a Grid Property, and im saving my properties to a file with XML.
So when I open the created file i see this
...
<property>
<name>Path</name>
<type>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</type>
<value>
<string />
</value>
</property>
<property>
<name>Export_To</name>
<type>System.String[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</type>
<value />
</property>
<property>
<name>Species</name>
<type>System.Collections.Generic.List`1[[MySolution.MyProject.MyClass.Species, MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</type>
<value />
</property>
</properties>
...
Until here is OK. The problem is when i want to load newly this file. The problem is because i have my class into a dll (created by me).
For this motive Im getting this error message.
"Is not possible load the file or assembly 'MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'" or one of it's dependencies. The System can not find the file specified.
but if I include this property into my project 'directly' there is no problems (the problem is that i need this into my dll)
Can some body tell me how to fix this problem, to load newly my properties
Thankyou
|
|
|
|
|
If I understand correctly, you are attempting to use reflection to instantiate the "MyDll" assembly using the config data held in your Xml file. if so, are you specifying the path correctly when you load the assembly? By default the assembly trying to load MyDll will look in its own path, unless you specify an explicit location. check that MyDll.dll is located in your executing assemblies bin folder.
|
|
|
|
|
Hi
Thank you for your help...
but, i don't want to copy the dll to the assemblies bin folder, what i want is save my data (xml) in any location and later load this file without specify a path.
For example:
if my dll is into c:\tmp\mydll.dll
and i try...
<property>
<name>MyProperty</name>
<type>System.Collections.Generic.List`1[[MySolution.MyProject...MyClass.MyProperty, c:\tmp\mydll.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</type>
<value />
</property>
it fails me.
How can i fix it?
Thank you
|
|
|
|
|
Hi
It would seem to me that the issue is related to the location of the myDll.dll (or at least where the calling code is expecting to load it from). Please supply a snippet of the code that in creating your myDll.dll and if possible, the full error detail you are getting.
|
|
|
|
|
Hi,
I am wondering, if I need to dispose the LINQ to SQL DataContext Object or it will be collected by the Garbase Collector ? In my ASP.NET Application, I am using many instances of DataContext Object in different method in a same page and my server complained that, I am causing memory issue. I am suspecting it could be related to my usage of LINQ to SQL DataContext, but I dont understand if I should use a single static DataContext in my Web Page so that all methods in the same page shares that DataContext Object or If I should create new instance of DataContext object in every method ? I placed the DataContext within a using statement so that it get disposed as soon as it is used, but I get an Exception 'Cannot access Disposed data context object'. So, I am getting more confused. How come the object gets Disposed already before using it ? Would you please tell me about the best way of disposing the data context in ASP.NET application so that I can optimize for memory usage ?
|
|
|
|
|
Sounds like you have tried to reference the DataContext object outside of the using construct.
Can you show a fragment of your code?
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Hi,
Thanks a lot for your reply. I have following code in my ASP.NET page. I am wondering If it is more efficient to place the line SpDBDataContext myDbContext = new SpDBDataContext(); globally and override the Page's Dispose method and call the myDbContext.Dispose() method inside that Disposer !!
<br />
protected void _linqDataSourceProductsFirst_Selecting(object sender, LinqDataSourceSelectEventArgs e)<br />
{<br />
using (SpDBDataContext myDbContext = new SpDBDataContext())<br />
{<br />
var productResults = myDbContext.products.Where(x => emran.publish).OrderBy(x => x.isFeatured);<br />
e.Result = productResults;<br />
}<br />
}<br />
This linqDataSourceProductsFirst is a LinQDataSource control placed in ASP.NET page.
|
|
|
|
|
I highly doubt that the DataContext is causing any memory issues, you have other issue that need to be resolved.
Emran Hussain wrote: How come the object gets Disposed already before using it ?
Your answer is here
Emran Hussain wrote: I placed the DataContext within a using statement so that it get disposed as soon as it is used
From the sounds of it you need more education on designing and implementing a layered system and how garbage collection works in the .net framework.
Your data access should be abstracted out of the page code, in a separate class or even assembly. Start there.
I know the language. I've read a book. - _Madmatt
|
|
|
|