Saturday, May 28, 2011

How to add Sql database on lan

In brief..
Make sure the server has working Sql Server service (cmd /k sqlcmd -L)
Make an intact lan network between 2 pcs
Turn off windows firewall on both pcs (firewall.cpl)
Check both pcs can ping each other by name or ip without any problem
Open Microsoft Sql Server Management studio
open Security-->Right click on Logins-->New Login
Add new Login For your server database
In General -->Login name
             Password
In server roles--> Public
In User mapping-->Choose your database
    Check db_Owner
    Check Public
Click OK
In Client side use one of the following Connection Strings:
connectionString="Data Source=eeelaptop\SQLEXPRESS;
                  Initial Catalog="NORTHWIND";
                  Integrated Security=False;
          User Id=ali;
    Password=ali123"
           
or

connectionString="Data Source=192.168.0.1\SQLEXPRESS;
                  Initial Catalog="NORTHWIND";
                  Integrated Security=False;
          User Id=ali;
    Password=ali123"

This is the general template:

connectionString="Data Source=<Server name or ip>\<Sql server service>;
                  Initial Catalog=&quot;<Database name>&quot;;
                  Integrated Security=False;
          User Id=<User name for database>;
    Password=<Password for database>"
           
That's all you need to make it working connection .

Saturday, May 21, 2011

Palms POS screen shots

My work is almost finished,Here is some screen shots for Palms POS project


As you can see ,It is entirely in arabic language and still not finished yet.
I will post a lot of explaination and capabilities for the application.

Monday, May 16, 2011

How To change the BackColor of listview

May be you have tried this code below :
.
ListView1.Items(0).SubItems(1).BackColor = Color.Red

.
But It does not work,
The trick is that you should add this line of code when you add new ListviewItem

Dim lvi As New ListViewItem 
lvi.UseItemStyleForSubItems =False
'To disable the style from the subitems

ListView1.Items.Add(lvi)

Simple things sometimes give you alot of headache
.

Friday, May 13, 2011

How to Change image from colors to gray scale

I was searching the net for changing the image colors to its gray scale

Color to grayScale with Transparent Background
 I found a good example here
But It changes the background color also
to it's black-white,So it appears in black color.

With simple a change in code to fix the problem
here it is:

Public Function ConvertToGrayScale(ByVal Source As Bitmap) As Bitmap
Dim bm As New Bitmap(Source.Width, Source.Height)
Dim x As IntegerDim y As Integer
Dim FirstPixelColor As Color
FirstPixelColor = Source.GetPixel(0, 0)For y = 0 To bm.Height - 1
  For x = 0 To bm.Width - 1
  Dim c As Color = Source.GetPixel(x, y)
  If c <> FirstPixelColor Then
      Dim luma As Integer = CInt(c.R * 0.3 + c.G * 0.59 + c.B * 0.11)   

      bm.SetPixel(x, y,Color.FromArgb(luma, luma, luma))   Else
      bm.SetPixel(x, y,Color.FromArgb(0, 0, 0, 0))
  End If
  Next
Next
Return bm

End Function

Just copy and paste and try it ,If you have a simpler method tell me.

Wednesday, May 11, 2011

Palms POS Or Cashier POS

Hi guys I am still working on my project ,It 's been now 4 month since I started out developing from a simple Products-prices list application to a full commericial level working program.

At first It was called Cashier POS
I have made many splash screens and beautifull banners for Old name but I did not like it .
I am working right now on printing Barcode labels ,I do not know how to print barcode labels on Sticker Papers or Sticker paper sheet ...I think this need some research.
See you soon

Tuesday, May 10, 2011

A generic error occurred in GDI+

A generic error occurred in GDI+
If you got this error ,Remember this it is something wrong with saving images or using memory stream to save them
And more specifically in disposing the memory stream object after using it in other word premateurly disposing the memoryStream object .
In my application it happens when I used the Using ... End using statment
Using MS as new memoryStream
ENd using
Solving it would be just like this
Dim MS as new MemoryStream
Ofcourse you know that I am using the memoryStream to hold the image.
The nasty problem in this error is that the debugger gets confused and does not point to the line cuasing the problem and you think it is other thing.

Sunday, May 8, 2011

PalmsPOS startup schema

I was working in Palms POS project and I was thinking about the startup scenario in the project ,
so I wrote a simple primary scema of how It would start
I included a User-Login system in the project startup
But It is still under development in the mean time and needs a lot of work.
The problem is that I do not have a lot of time enough to do it.

Configuration system failed to initialize

As I was adding my project to n-tier projects an error occured saying:
The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception
and in it's details it is saying:
Configuration system failed to initialize
I tried to figure out the solution bu in vain
I also did some search but I noticed that everybody is taking that it is a problem in app.config and user.config files
So after hours of pain:
I fixed the problem by deleting the user.config file and deleting an error in app.config file more specifically in userSettings
I noticed that it is writen twice so I deleted one of them
Also I made sure that <ConfigSection> is the first Root in <Configuration>
Try This It may help you ,Tell me your experience

Friday, May 6, 2011

No crystal report in toolbox

In VS 2010 crystal report 2011 if you choose to start a new project Windows form application you can not see crystal report in toolbox
 so You need to choose Crystal report project so that crystal report document and crystal report viewer
appear in the toolbox
and thats because
By default, when you create a new .net 4 Windows Form application, it uses the .net 4 Client Profile framework, not the standard .net 4 framework. Convert it to .net framework standard.
To make it possible to see crystal report controls in toolbox

Hope thats help you

Error in crystal report 2011 that needs db_crldp.dll file

When using crystal report 2011 in vb.net 2010 in net framework 4.0
a mysterious error occurs that needs some file like db_crldp.dll ????
sol:
paste this in the app.config:

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

Wednesday, May 4, 2011

Palms POS page sketch

I was working on Palms POS and found that old POS page was not very efficient so I changed it to a new style ,May be I did not post my old page but I think it is better to see the new one
As you can see I have very much work to do...
I am sorry I am a new blogger and do not have much time to write every detail but I will try my best

Tuesday, May 3, 2011

microsoft.ace.oledb.12.0 is not registered in the local machine

change application configuration to x86 instead of AnyCPU to work in windows 7 or windows 64x
or you may see this error
(microsoft.ace.oledb.12.0 is not registered in the local machine)
you might get the same error if you are using access database 2007 (.accdb) change to 2003 (.mdb) this solves the problem
also you can download MicrosoftAccessDatabaseEngine_64x.exe from microsoft website but will not do any good..

As you can see I am keeping posting only error-posts an not talking about Palms POS thats because these errors gave me a lot of headache and some of them are silly but I did not know how to handle them,
So I really want to post them so any one who faces these errors my get benefit from my solutions or share with us his/her opinion.

And about Palms POS its still under development ,But I promise I will talk a lot about it in the near future and the development difficulities I faced.

I am not sure about the Arabic interface of my blog..I think I will changed it to English becuase I am really a slow writer in Arabic.