|
I am trying to edit VB 2005 code developed by someone else. The developer put controls in splitter panels. It is not necessary to use them in this app and it also makes it difficult to edit the GUI.
How do I remove the panels/container? Highlighting the panel and pressing "Delete" does nothing.
Thanks!
|
|
|
|
|
In the Form Designer pressing Esc moves focus to the parent of the currently selected control.
What's probably happening is that you are selecting Panel1 or Panel2 of the SplitContainer and these cannot be deleted. So do as you did before but hit Esc before Del. This will take focus to the SplitContainer itself, which can be deleted.
Hope this helps.
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.”
|
|
|
|
|
If I get you right, before deleting the SplitContainer, you need to move the container's child controls directly to the form (or wherever the split container is placed). You can do this pretty easily by directly editing the designer generated code. But if you are not sure, use the designer.
1. Set the Dock property of the split container to None and make it smaller so yo have room in the form for other controls.
2. Drag the child controls from Panel1 and Panel2 to the form.
3. Now delete the split container.
|
|
|
|
|
Another related tip....sometimes it is hard to get the correct control selected if you have several overlapping or contained within each other. For example, lets say you want to select the split container not the splitpanel1 and not a textbox inside splitpanel1. If you right click on the textbox in design mode the context menu will provide options to select the different controls that are on top of each other. I've found this very useful so I thought I'd pass it along.
Hope this helps.
|
|
|
|
|
Actually Iam using Office 2007. So I added the reference, Microsoft.Office.Interop.Excel 12.0 to my project.
Iam using vb.net 2008.When I try to insert a picture in Excel. I get a error "Reference require to Assembly 'Office....,
version 11.0.0.0....Microsoft.Office.Core.MsoTriState add one to your project...
I cannot find this reference. Where to find?
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Add(misValue)
xlWorkSheet = xlWorkBook.Sheets("sheet1")
xlWorkSheet.Cells(1, 1) = "CODEPROJECT"
xlWorkSheet.Cells(2, 1) = "Adding picture in Excel File"
'PROBLEM IN BELOW LINE
xlWorkSheet.Shapes.AddPicture("C:\xl_pic.JPG", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 45)
xlWorkSheet.SaveAs("C:\vb_net\vbexcel.xlsx")
xlWorkBook.Close()
xlApp.Quit()
Thanks
|
|
|
|
|
Looking at the various results on Google when searching for msotristate, you also need to add the COM reference to Microsoft Office 12.0 Object Library.
When i did this the error went away.
|
|
|
|
|
Hi all,
I'm working on a application which searches for '_FLEX' or '_FLEX_' or '_CABLE' or _'FERME' in a text file.
If found do some action.
I use the below code to set the index to search for the above words.
Issue:
There is a line in the text file in the name fields with '_FLEX1'.
When this word is found, it does the actions that need to be done for lpFlex or lpFlex_ found.
I have used name.IndexOf for '_FLEX' and '_FLEX_' but when found'_FLEX1', it has performed the actionsof lpFlex or lpFlex_.
I dont want any action to be done when something other than lpFlex or lpCable or lpFeme or lpFlex_ found.
I think its because I use name.IndexOf().
Is there some other function/method to search for the specific word in a field/line?
Where am I going wrong?
Any help and suggestion please.
Thanks in Advance.
modified on Monday, October 26, 2009 11:13 AM
modified 28-Nov-12 7:40am.
|
|
|
|
|
Vijay,
use contains method like..
If name.contains("")
'your code
Hope it helps
|
|
|
|
|
Thanks for your reply and suggestion.
|
|
|
|
|
string.Contains will give you the same problems. Use regular expression instead.
|
|
|
|
|
If I understand your question correctly, you only want the action to happen if an exact match is found for one of your trigger words.
This might be very difficult, although it partly depends on what character 'should' follow them. For example, if they should always be followed by a space, then test for "_FLEX ", "_CABLE " etc.
If "_FLEX1", is guaranteed to be the only 'problem' then a test like:
If sampleText.SubString(resultOfIndexOf, 6) = "_FLEX1" THEN Return 'or whatever will ignore that entry
If they can be followed by anything then it would be extremely difficult. It may be possible by using Regular Expressions but I do not have sufficient skills in that area to say for sure. If after a couple more hours no-one has offered a solution I suggest that you post a new question with a title like "Regular Expression problem", that will usually attract the Expressionistas. If you do that, please be sure to mention that you asked earlier but got no luck but someone suggested RE might do the trick.
Good Luck!
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.”
|
|
|
|
|
Hello All,
I am new to .NET.
Can any body please tell me how to catch all possible error that PrintDocument.Print() method returns!!!
I have installed a dummy printer on my machine..and tried to give print using PrintDocument.Print() method, but it is not giving any error. When i tried with an older application(which is written in C,C++)..it is throwing an error saying Network printer error.
How can i catch same error using VB.NET 2005.
Thanks in advance.
Regards,
Sr
|
|
|
|
|
Just put a try/catch round your code, that will capture all exceptions.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Bob,
No luck with Try/Catch. With PrintDoc.Print() it is adding document in queue. where as my old system not adding doc to printer and is shoing error like network error.
Really i want solution for this..if printer does not return any vaklue then my code goes wrong.Please assist me.
Regards,
Sr
|
|
|
|
|
sri_0099 wrote: With PrintDoc.Print() it is adding document in queue
And is the document correct? If so, maybe you need to be checking the printer status or something? Its years since I used printdoc, so I can't remember all the commands, but there should be something to check the printer status I would expect.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello,
Can someone tell me how i can tell my exe to look into sub folders if the dll being referenced isn't in the folder the exe is. I found the server config code but it doesn't work in the exe config.
Thank you.
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Nathan,
Use System.AppDomain.CurrentDomain.BaseDirectory to get root directory where EXE is. from rootdirectory you can fetch directories inside root directory.
Regards,
Sr
|
|
|
|
|
Thanks Sr...that doesn't work with references
I have several apps that reference dlls that have controls in them. Typically those same dlls would be in the same folder as the exe. Because of "cluttering up" the main folder i wanted to move the dlls and their supporting files into a sub folder. I want the exe to look local and then go through sub folder(s) to look there as well before it comes back and tells me "file not found". There is a config setting that you can give to make it do that on the server. I just need to know what is the config setting to do that for the exe.
Thank you...
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I amnot familiar with this type of operations but looking at the MSDN documentation;
AppDomainSetup class contains a method PrivateBinPath which states;
Gets or sets the list of directories under the application base directory that are probed for private assemblies.
Don't know if that will help or not!
|
|
|
|
|
Thank you Dave...your privatepath gave me the right thing to lookup.
If you add this to your exe config, it will look in sub folders as well as the base directory for files that you are referencing.
In the example below, I want the exe to also prob sub folder controls.
<configuration>
<runtime>
<asemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="controls"/>
</assemblyBinding>
</runtime>
.
.
.
</configuration>
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
hi
I established a data base connection, where I used a query
sql_querry="SELECT name FROM sample_table"
is displaying all values perfectly, now I want to use where condition
sql_querry="SELECT name FROM sample_table WHERE"+"(Designation=SE)"<br />
But it is throwing an exception.
I think this one I am getting because I am not giving query perfectly.
Please tell me how to write this query.
Thanx in advance...........
sampath-padamatinti
|
|
|
|
|
sql_querry="SELECT name FROM sample_table WHERE Designation='SE'"
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
You should not use inline queries, they are dangerous and can lead to SQL Injection attacks.
Before you get a bad habit ingrained into your coding style learn how to use parameterised queries (or parameterized queries, spelling differs). There is a reasonable tutorial here[^] in PDF format, although it deals with Access it covers how to convert an inline query into a parameterised one, and the principles are the same. If you don't like that one then there are plenty more examples, just google for the phrase.
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.”
|
|
|
|
|
sampath-padamatinti wrote: sql_querry="SELECT name FROM sample_table WHERE"+"(Designation=SE)"
On tpo of what everyone else said, if you look at the string you built closely, you'll see there is no space between "WHERE" and "(Designation=SE)". The resulting SQL looks like this (which is not a valid statement!):
SELECT name FROM sample_table WHERE(Designation=SE)
|
|
|
|
|
Dave, SQL Server parses and executes this statement. But if there was no '(' after the where clause, things would be different
|
|
|
|