|
ConnectionStrings.com[^]
Why are you even using a DSN?? All it is is a connection string in text file...
BTW, that's ODBC, not ODBE. And I highly suggest using OleDb instead.
Since Access is a file-based database, you have to have a path to where the file is located. That'll be a fully qualified path starting with a drive letter (network mapped drive) or a UNC path (\\server\share\...).
And for the love of ______, please stop using VB6 and move to VB.NET. VB6 has been dead for quite some time now.
|
|
|
|
|
Hello !
Please tell me how can I scroll a panel without a scrollbar or make scrollbar invisible
Panel_coord_x.AutoScroll = True
Panel_coord_x.VerticalScroll.Visible = False
Panel_coord_x.VerticalScroll.Enabled = False
Panel_coord_x.HorizontalScroll.Visible = False
Panel_coord_x.HorizontalScroll.Enabled = False
the above code not working.
In my form I have a main scrollable panel and 2 small panels representing the screen coorinates. When I scroll the main panel,the other 2 panel must scroll also :
If (e.ScrollOrientation = ScrollOrientation.VerticalScroll) Then
Panel1.VerticalScroll.Value = e.NewValue
Panel_coord_y.VerticalScroll.Value = e.NewValue
Else
Panel1.HorizontalScroll.Value = e.NewValue
Panel_coord_x.HorizontalScroll.Value = e.NewValue
End If
This is working fine except : I can't hide the vertical and the horizontal scroll bars for the second 2 panels.
Panel_coord_x.HorizontalScroll.Visible = False
and
Panel_coord_x.AutoScrollMinSize = New Size(0, 0)
does nothing.
Thank You !
|
|
|
|
|
None of that is going to work because if you Make the scrollbars Visible=False, you turn them off.
You would have to put a Panel control inside another Panel control then change the Location of the inner Panel control to scroll the content up and down. Setting the Vertical and Horizontal scroll values will do you no good because you don't have any scroll bars.
|
|
|
|
|
That's how I do it.
I've also had occasion to use touch screens, and use the same panel trick. When it fires a mouse-down event, we track the starting position. If you move your finger past a certain distance from the start point, it scrolls the panel. If you don't pass the threshold, the button gets the mouse-up event fired. It works pretty well, and is good in a distribution environment.
|
|
|
|
|
Hello!
I am trying to make a 2D map editor for my game.
My map is based on a grid 48x48 pixels and 3000 cells(1 cell=48x48pixels).
To do my editor I created a PictureBox array on a scrollable form.
Here is my code for the array :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.AutoScroll = True
Dim rows, columns As Integer
rows = 0
columns = 0
For i As Integer = 0 To 3000
Dim my_picture As New PictureBox
my_picture.Parent = Me
my_picture.Size = New Size(48, 48)
my_picture.Top = CType((rows) * 49, Integer)
my_picture.Left = CType((columns) * 49, Integer)
my_picture.Image = My.Resources.board
my_picture.Visible = True
columns = columns + 1
If columns = 60 Then
rows = rows + 1
columns = 0
End If
Next
End Sub
Each of my image have 5 events :
Mouse Click
Mouse Enter
Mouse Leave
Mouse Move
Mouse Hover
Everything is working fine but to load the form for the first time takes about 30 seconds on a I7 PC with 8 GB DDR3 working on Win7x64 bits.
Can you tell me what to do to take less time to load all 3000 cells ?!
Thank You !
|
|
|
|
|
You should never use hundreds of Controls on a single Form, Controls are expensive and slow, as you discovered.
If you are considering a matrix/grid of Controls, rethink your design, and go for a single Control that behaves like a 2D collection of smaller ones: a single Panel could be made to paint 3000 smaller images, its Click handler could decide which cell got clicked and fire an event in the right cell, etc. Yes it will take a bit more code, but then it will behave as it should. In summary define a Cell class that isn't a Control, all it does is (a) implement its business logic, and (b) tell your overall Control the GUI parameters (mostly position and rendering info).
|
|
|
|
|
Can you point me to a sample please ?
|
|
|
|
|
Unfortunately I don't have one around.
I looked at some of the board game articles here on CP:
- for the smaller boards (chess, reversi), they tend to use a Control for each cell (hence 64, acceptable).
- Hexomania - A Game for Hexagons[^] doesn't use a Control per cell for obvious reasons, however it doesn't have a Cell class either.
- My Sokoban article[^] (the only game I published about) has a single Panel (see file Board.cs), however it doesn't use a Cell class, it has a number of objects that move around; and it doesn't use the mouse at all, it is keyboard driven.
I suggest you look around some more, there's bound to be a good example in there somewhere.
BTW: when most examples seem to be in C#, that is not really relevant; the same concepts would apply no matter what language you use.
|
|
|
|
|
I have created a windows service (in VB, using VS 2010) and once I have it installed and attempt to run it, I receive the following error in the event viewer:
Service cannot be started. System.InvalidOperationException: Cannot change service name when the service is running.
at System.ServiceProcess.ServiceBase.set_ServiceName(String value)
at PostProcessing.PostProcessing.InitializeComponent()
at PostProcessing.PostProcessing.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
I have a feeling that this has to do with the installer, but not sure what to check. All of the names are "PostProcessing". Anybody have an idea for me? Thanks.
|
|
|
|
|
OK, looking the stack trace, in your OnStart handler, you're calling an InitializeComponent method. You normally don't see that in a service at all, but you do in Windows Forms apps. Makes me wonder what you're doing...
From the InitializeComponent method, you're doing something with a ServiceBase object. Perhaps you inherited that in a class of yours??
Perhaps you're setting a Name property somewhere you shouldn't be??
It's easy enough to trace. Put a Thread.Sleep in your OnStart method for, say, 20 seconds. Then set a breakpoint on a line just after the Sleep. Start the service, then go to Visual Studio and in the Debug menu -> Attach to Process... Find your service and attach to it. When you hit the breakpoint, you can step through the code line-by-line and watch what happens.
|
|
|
|
|
Your reply made the error make sense. Esp. the "InitializeComponent" piece. I wanted to use a windows service so that I could use the timer to schedule it rather than schedule a task to run as a user. I have moved the project to a windows form, and will use a service to run the program instead. Most likely what I want to do would not work as a service anyways...
My objective: Multiple transactions against a remote server, sending and receiving JSON, deserializing the responses and then taking the appropriate actions on a MS SQL server db.
|
|
|
|
|
Hi,
I'm having a problem using reflection in VB.Net (.NET Framework 2.0).
Here's a simple version of the code:
Dim myAssembly As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile("C:\MyApp\Extras\Bob.dll")
For Each typ as System.Type In myAssembly.GetTypes
...
Next
My application is running from C:\MyApp. One of the classes in Bob.dll inherits from a class in Ben.dll. Now, unless Ben.dll is in my application's directory (C:\MyApp) I get a ReflectionTypeLoadError saying it can't find ben.dll.
Does anyone know of anyway I can get this to work by having ben.dll in c:\MyApp\Extras? Can I get it to check the C:\MyApp\Extras folder instead/as well as the app path somehow?
Thanks.
|
|
|
|
|
Hi Friends,
I am trying to do Bulkcopy of xml records to SQL Server 2008.
I am using the below code. But I am getting error
"
ActiveX component can't create object SQLXMLBulkLoad.SQLXMLBulkLoad"
This is my code:
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "server=Testdb;Database=CApp;UID=dbo;Password=dbo;LANGUAGE=us_english"
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\customermapping.xml", "c:\customers.xml"
Set objBL = Nothing
Please help.
Thanks and Regards,
R. Sangeetha Priya.
|
|
|
|
|
From this article : XML Bulk Load Examples (SQLXML 4.0)[^]
It would appear that you need to change
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
To
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad.4.0")
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hello !
i'm new in vb.net and sql server.Now i'm starting to create an application using vb.net 2010 and sql server 2008R2 express.
i need a suggestion :
Should i use direct communication with sql server ( sql commands..) or using dataset ?
what is the best way ?
Thank you in advance.
|
|
|
|
|
There's no way to answer that question because you haven't said anything about what you're doing.
There are various methods to access data in a database. What you're doing with the data and your business requirements have a far more direct impact on how you access the data than what you're using.
|
|
|
|
|
the database contains about 25-30 tables .Each table has 5-15 columns.i want to do normal operations with a database : edit data , update , delete , add... etc.And i need to create reports with different data on database.
|
|
|
|
|
Again...that's what you have, not what you're doing.
For example, if you're going to do some kind of processing on, say, 10000 records, you're not going to use a DataTable for this. You'll probably going to use a DataReader.
Now, if you're going to bind a control to a couple of dozen records just to show them, you'd probably use a DataTable or DataSet and not a DataReader.
What method works best for each situation is dictated by precising what you're doing, not what you have.
|
|
|
|
|
Thank you , for your suggestions.
But , i make more simple my question :
i'm a beginner on working with vb.net + sql server. Until today , i have developped several application in MS Access (backend + frontend).
But now i want to make something in vb.net+ sql server. Someone suggest to use typed dataset because
is more easy for begginners and is similar with the way i have worked in ms access.( it's easy to create forms with bounded controls , it's more easy to create reports....)
Is this true ?
thank you.
|
|
|
|
|
It could be. You don't konw until you try.
|
|
|
|
|
The first thing I can suggest to you is to read up on the different Areas of database communication. Personally I prefer the second technology but I have put it here for you to read upon
TableAdapters[^]
ADO.NET[^]
Until you have a understanding of these I wouldn't yet approach LinQ or Entity Frameworks, that just my 2 cents on learning database communication.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Without knowing the details of the project, I can't answer exactly, but...
We actually abstracted the SQL interface for our in-house software, so we don't often need to actually deal directly with the SQL server, we just write the commands and then get a result. I suggest you try something like this if you don't use datasets. It'll make your life alot easier writing and maintaining the code.
If you have any queries you call frequenty, I would also suggest that you sent them up with their own functions to automatically create the SQL command. Again, it'll make maintainance much easier.
|
|
|
|
|
I suggest you to try all types of communication while you are a beginner. When you'll start professional programming then you can decide what is best for your program. I telling you to see another tools (Entity Framework) to manipulate database http://www.microsoft.com/download/en/details.aspx?id=18504[^]
Good luck.
|
|
|
|
|
In my application, I need to address multiple configuration files. This is because different people will supply a configuration file and the application should process the information inside.
The layout of each configuration file looks like this:
<section>
<subsection id="sub1" >
<item id="item 1" value="value 1" />
<item id="item 2" value="value 2" />
</subsection>
<subsection id="sub2" >
<item id="item 1" value="value 1" />
<item id="item 2" value="value 2" />
</subsection>
</section>
Is there an easy way to keep track of several .config files and can I read those using the configuration manager? Or should I write a class to read several .xml files with said format?
|
|
|
|
|
It's probably better to create a class which will isolate you from the storage mechanism in the long run as you might have to switch out the xml to a database if your users grow, or you have to add backup logic etc.
This will all depend on how you see the usage growing.
You can also use a Key/Value store like RaptorDB to store the information which is scalable.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
|
|
|
|