|
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.
|
|
|
|
|
Hmmm... it looks like your TextBox member variable is okay.
Have you tried stepping through your code in debug mode? Try placing a break point at the beginning of your Form Load event code and see exactly where your exception is occuring. It might not be crashing where you think it is.
|
|
|
|
|
HI, VB Net used.I have this form that has tree View on the left and a data grid
On the right being fill by a Database Access from a dataset. I have
Already set the connection with Oledb 4.0 making a dataset, and using the following
Request requete = "SELECT * FROM PRODUITS WHERE CATEGORIE = 'Inventaire\Bushing';"
Up to hire OK. I would like to know if it is possible to replace the condition in the WHERE clause like this example 'Inventaire\Bushing';" by a variable like this 'lb1Path.Text. I try this, but it doesn’t work see my example: request
requete = "SELECT * FROM PRODUITS WHERE CATEGORIE = 'lb1Path.Text';"
As you can see what I am trying to do is when I click on one of the tree nodes who
Are by the way Category to put up trough the variable lb1Path.Text. May be there are other ways to do that, if so a lot of help will be appreciate. Thank you
See my code sorry for the French.
Private Sub se_connecter(ByVal requete As String, ByVal table As String)
Dim base, chemin As String
'Chemin d'accès à la b.d. située dans le dossier bin
chemin = Application.StartupPath & "\INVENTAIRE.MDB"
base = "provider=microsoft.jet.oledb.4.0;data source=" + chemin
Dim connexion As OleDbConnection = New OleDbConnection(base)
connexion.Open()
'Lien entre la base et la requête
Dim Liaison As New OleDbDataAdapter(requete, base)
Dim Memoire As New DataSet
'Charge la table en mémoire
Liaison.Fill(Memoire, table)
Dim Vue As New DataView(Memoire.Tables(table))
grille.DataSource = Vue
connexion.Close()
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim node As System.Windows.Forms.TreeNode
node = TreeView1.SelectedNode
lb1Path.Text = sender.SelectedNode.FullPath
'MessageBox.Show(TreeView1.SelectedNode.ToString)
'Dim choix As Byte
Dim requete, table As String
'Sélectionne tout
requete = "SELECT * FROM PRODUITS WHERE CATEGORIE = 'Inventaire\Bushing';"
table = "PRODUITS"
se_connecter(requete, table)
'J’essaiyé ceci mais ca marche pas
requete = "SELECT * FROM PRODUITS WHERE CATEGORIE = 'lb1Path.
|
|
|
|
|
Try out this code:
requete = "SELECT * FROM PRODUITS WHERE CATEGORIE='"& lb1Path.text & "'"<br />
or <br />
requete = "SELECT * FROM PRODUITS WHERE CATEGORIE ='"+lb1Path.text+"';"
I hope it'll work fine
go ahead... happy programming....
Uttam;)
try to be the best... whereever you go,
|
|
|
|
|
I dount there is a way to do this, but does anybody know if i could make a program in VB.Net that will save Word Documents your working on every so often? (I hope you can understand my question)
|
|
|
|