|
well i read through it and it did help thank you, but now i've got a new problem, so maybe i didn't catch everything in that reading. but heres the new code and the new error that is compile time error
code:
Imports System.IO
Imports System.Security.Permissions
Imports System.Runtime.InteropServices
<assembly: permissionset(securityaction.requestminimum,="" name:="Full Trust" )="">
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oFile As File
Dim oWrite As StreamWriter
Dim oRead As StreamReader
oWrite = File.CreateText("test.txt")
oWrite.WriteLine("test test test")
oWrite.Close()
oRead = File.OpenText("test.txt")
TextBox1.Text = oRead.ReadToEnd
oRead.Close()
End Sub
End Class
error:
Unable to emit assembly: Unexpected exception processing attribute -- System.ArgumentException: Unable to generate permission set; input XML may be malformed..
all this stuff is new to me.
|
|
|
|
|
Hello every body.
I have a problem with the image adding on an MDI container in vb.net. Image looks fit. But when a child form is opened it hides behind the image box control. Can any body suggest me about the problem. And how to solve it.
I shall be grateful to you......
FIRE
|
|
|
|
|
Yeah, that's been coverd dozens of times in the forums. ANy control you put on the MDI parent will show ABOVE any MDI Child forms. This is because there is a hidden control in the MDI Parent that actually serves as a container for the child forms. Any control you put on the MDI Parent form will be over the top of this hidden control.
You can read more about the MDIClient contorl, here[^].
If you closely enough at that documentation, you'll find it even has it's own BackgroundImage property. All you have to do is interate through the controls on your form and find the only instance of an MDIClient control, cast a variable to it, then set its BackgroundImage property.
If Me.Controls.Count Then
For Each control As Control In Me.Controls
If TypeOf control Is MdiClient Then
Dim mdiClientArea As MdiClient = CType(control, MdiClient)
mdiClientArea.BackgroundImage = New Bitmap("filepath")
Exit For
End If
Next
End If
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Writing my own update statements for a fairly complex datagrid. When running my insert/update/del statements I get "parameter ?_5 has no default value." in the error icon on the left next to each modifed record, and no updates are performed.
Trying to understand what field ?_5 is in the whole scheme of things. Field in dataset, field in SQL statement, what.. and how to make the error become more understandable...like change it to display the field name?
thanks for any help or ideas..
|
|
|
|
|
i have this problem thats got me firing ...
i have an array that holds files locations (one,two or more files),
i need to get these files and merge them into one file in VB.NET can someone help me ... its killing me!
elms
|
|
|
|
|
What's the problem you're having?
This is a straightforward problem. You open/create the target file, then open each file, one at a time, from the array. Read the file, line-by-line, and write each line to the target file. Close the source file, then get the next filename and open it. Read it, line-by-line, ... When you get through the list, close the target file and you're done.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I tried to get the short date format from the regional and language control using the API function GetLocalInfo. whatever is my culture, I want the short date saved in control panel. I execute the API function without any problem in VB6 and I get the same format saved in control panel.
but in VB2005, when I call the API function it return an error:
A call to PInvoke function 'Schools!Schools.My.MyApplication::GetLocaleInfo' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
can anybody help me please.............
OmarMallat
|
|
|
|
|
You got the parameters in the Declare statement for GetLocaleInfo wrong. For example, a Long in VB6 is equivilent to an Integer in VB.NET, not a Long. This is probably where most people go wrong when converting their code.
But, since all the Locale API's in Win32 are wrapped in the .NET Framework Base Class Library, why are you even calling this?
Dim df As DateTimeFormatInfo = Thread.CurrentThread.CurrentCulture.DateTimeFormat
More on the DateTimeFormatInfo can be found here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave but this solution give me the format based on the culture of my application and not the culture in regional settings.
so my application run with a culture "fr-FA" and your command give me "dd/MM/yyyy" although the regional setting have the culture "en-US" so the format is "M/d/yyyy".
I found a solution, but it is not perfect:
before I set the culture of my application to "fr-FA" or "ar-LB", I catch this variable so I find it same as the regional setting because when the application start loading it have the same culture as the regional setting. and I put this result in a public variable.
but let we say that while my application is running, the user go to the regional setting and change the format manually, so my variable still having the old format, and several problems may occur...
thanks anyway... but still waiting
OmarMallat
|
|
|
|
|
OmarMallat wrote: but let we say that while my application is running, the user go to the regional setting and change the format manually
Not likely, but it's possible. Changing the system-wide regional settings is usually done only once and left that way. Changing it in the control panel effects the ENTIRE system, not just your applicaiton.
OmarMallat wrote: so my variable still having the old format, and several problems may occur...
In normal applications, it's expected that if a change like this is made, the application must be restarted for the change to take effect. There is no SystemEvent that tells you that the locale was changed.
When your application starts, it starts with the culture settings specified in the Regional control panel. The bigger question is, why is your application switching cultures after it starts?
If the date format is that critical, and NOT tide to the culture settings, why don't you just offer this format as a configuration option in your application. This setting will effect only your application and can be changed at any time.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you very much for your comments.
my application has an options to run with multi interface and culture. and it runs with the last option selected.
I found a problem while converting date, if there is a diffrence between the date format in regional setting and my application.
but if I know that in regional setting, I can convert date as I want without any problems.
now, what I do is that:
when I want to search any date, this date is in the format of the current culture selected by the application, while the database store the date with the regional setting format. this diffrence may cause that the date selected by the user will never be found...
so always, I convert date from my application culture to regional setting format to prevent error.
you have right that if a user change the regional setting format while the application is running, it must be restarted. but if I read the regional setting format with every date conversion, I prevent error, and no need to restart application.
Any way, my problem can be found on this article:
URL : http://www.codeproject.com/script/comments/forums.asp?msg=1301729&forumid=1646#xx1301729xx
please read the first comment to get the right problem.
OmarMallat
|
|
|
|
|
How are you saving the date in the database? As a String...like 12/11/2005? The date shouldn't be saved in ANY culture format, rather the native representation (no format at all) of the database engine.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
the database is with MSACCESS. and the field is with Date/Time data type, and the date will be shown as same as the regional setting.
OmarMallat
|
|
|
|
|
When you view the table in Acces, it's DISPLAYED in the current culture. It's most definately not STORED that way. There is no formatting of a date/time serial number in the database. The only thing you need the culture for is displaying the date/time and accepting date/time input in the correct format. Once you get the date/time into a DateTime object in VB.NET, the culture no longer applies.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I'm trying to print a form in vb6.0, without the background? The option
Printform, prints with the background even if i make forms DrawStyle Transparent. Is there a way to print a forms components as Textbox, Labels without the background????
It's quite urgent!!!
Thanks & Regards!!!
|
|
|
|
|
Hi
I want to generate on Demand Report /Nested Report in Crystal report 8.0 using Visual Basic 6.0 . I genegrate the
on demand report in Crystal report , it work at design mode well, but Calling It from Visual Basic , It works Simple Report , Link does not work .
Can u Suggest me , or Give some code for to solve the problem .
Thanks in Advance.
Manoj
|
|
|
|
|
hi to all
i have datagrid that contain a field with text .
i can not view all the text in the datagrid when i click on it ,
i remmber in vb 6.0 there was an option that when i click on the datagrid i can view it with all the text in the fields , the data grid exspand to height
thxx for anyhelp .
|
|
|
|
|
Try:
textboxname.TextBox.Multiline = True
textboxname.TextBox.ScrollBars = ScrollBars.Vertical
could also use:
ScrollBars.Horizontal
ScrollBars.Both
ScrollBars.None
hope that helps..
|
|
|
|
|
Hi.
Assume that we have an extender control (such as tooltip).
How can we add a Custom TypeEditor for extended property (such as tooltiptext).
Reza
|
|
|
|
|
Can you help me by providng with necessary code
Ravi Pratap
|
|
|
|
|
code:
Dim strme As String = Directory.GetCurrentDirectory
txtStatPath.Text = strme
error:
An unhandled exception of type 'System.NullReferenceException' occurred in foldingathomestatcompare.exe
Additional information: Object reference not set to an instance of an object.
don't know what the heck is going on but when i put it in a msgbox it works but as soon as i try and assign it to a textbox it doesn't work. someone please tell me what is wrong, and at all possible why.
|
|
|
|
|
My guess is that this code is in your constructor (ie: Sub New) just above the InitializeComponent() method. Am I right?
You see, your member variable txtStatPath (which I'm guessing is a TextBox) is assigned a reference in the InitializeComponent() method. Before that method gets called, txtStatPath is initialized to Nothing which would cause that NullReferenceExcepection that you are seeing.
The best place to put this code is in your Form Load event.
|
|
|
|
|
Private Sub frmSettings_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'retrieves settings from registry
getSettings()
'sets default path if not set to current directory
Dim strme As String = Directory.GetCurrentDirectory
txtStatPath.Text = strme
End Sub
as you can see it is not set and it is in the form load, altho this is a form that is loaded after the main form would that make a difference?
|
|
|
|
|
I recommend that you do a search for txtStatPath within your source file. Make sure that you search within all #Regions.
You'll want to make sure that txtStatPath gets assigned. You should see something like...
txtStatPath = New TextBox
|
|
|
|
|
Friend WithEvents txtStatPath As System.Windows.Forms.TextBox
Me.txtStatPath = New System.Windows.Forms.TextBox
Me.Controls.Add(Me.txtStatPath)
i pulled out all the txtStatPath info except for it's size location and such but it was in there.
|
|
|
|