Electrical Wiring in the Home/adding to a switch
My bedroom has a switch that works a plug, There was no ceiling light. I installed a ceiling fan with light kit snake wire into wall switch box. The wall switch has one set of wires coming into the box a black,white,and a ground,I can not get the switch to work ,
Actually, I suspect the switch works like it always did.
It is the fan and light (and now the receptacle as well) that don't work.
That is because you didn't understand what the wires were doing before you added the light and altered the wiring at the switch.
The original installation actually stops at the receptacle.
From there the ungrounded conductor (hot) is transferred to the white wire to the switch, where current is controlled and returned to the receptacle.
To do what you now intend, the white in the cable to the switch from the receptacle must be connected to the white attached to the receptacle (the grounded conductor or neutral) and fed directly to the light.. The black to the switch must be connected to the receptacle and the black which was connected to the white that went to the switch.
That way you feed the neutral white through to the light and provide a hot for the switch to control for the light.
Hazard warning. Electricity is dangerous.
Improper wiring can cause fires.
Electrocution hazard risk of injury and death.
Turn power off when working.
Are you qualified to perform this work?
See definition of qualified in National Electrical Code.
About Electrical Wiring in the Home
This site answers questions related to home electrical wiring, home wiring, general electrical help,and other electrical questions related to aleternating current (AC). You can find help on the National Electical Code, home electrical issues, wiring electrical outlets, installing lighting, electrical grounding, and general electrical help for do-it-yourself projects not require an electrician. If you do not see your home electrical wiring question answered in this area then please ask your electrical wiring question here