Going from VFR in Class B to IFR
There are several ways to do what you are requesting.  One way is to follow the guidance in the Airman's Information Manual, para. 5-1-7 (AIM).  This guidance describes how to use a &quot;Composite Flight Plan.&quot;  With this procedure you are filing a VFR flight plan and an IFR flight plan simultaneously, and in your case with the intention of using the VFR Flight Plan first.
Although the description in the AIM describes a flight in which the pilot is not already talking to ATC (as you plan on doing because you will be in Class B airspace) the general procedure is clear.  Depart the airport, open the VFR Flight Plan with the nearest FSS (or other facility), and at the appropriate point where you planned to begin the IFR portion of your flight and while in communication with ATC in the Class B airspace, request the IFR clearance.
After picking up your IFR clearance make certain that you cancel your VFR flight plan (you can ask the IFR controller to do this for you, but if you have a second radio you may just want to call the nearest FSS and cancel it yourself).
A second, perhaps more efficient method to accomplish what your question suggests is to: (assuming you are departing from an airport near or within Class B airspace)

File an IFR flight plan with a starting point at or abeam whatever location/fix etc. you want to begin the IFR route.
Obtain a VFR clearance into the Class B airspace from ATC (you won't have a VFR Flight Plan, but you will be receiving flight following and thereby realizing essentially the same benefit).
At the appropriate point as filed in your IFR Flight Plan, request the (IFR) clearance from the controller you are in communication with.
In this case you won't have a VFR Flight Plan to cancel.

I'm not suggesting that you should not have a VFR Flight Plan if you will be traveling anything other than a short distance before you start flight following (or a Class B clearance) from ATC.  But, if you are departing an airport near the Class B airspace and will be talking to ATC shortly after takeoff the benefits of having a VFR Flight Plan may be essentially irrelevant if you are already talking to ATC receiving flight following or Class B service and will be transitioning to an IFR clearance.
Lastly, if your only intention is to get an IFR clearance while you are flying along VFR, see &quot;How do you request a &quot;pop up&quot; IFR clearance?&quot; which has already been answered in this StackExchange. But since your specific question indicates that you are interested in a procedure where you have filed an IFR and/or VFR flight plan before departing I hope my comments help your understanding.